How many Timers Can I Create???

Joel Sherrill joel.sherrill at OARcorp.com
Mon Apr 12 16:18:23 UTC 2004


Kamen Penev wrote:

> Joel Sherrill wrote:
> 
>> Alex wrote:
>>
>>> Hi,
>>>
>>> Does RTEMS has a confifured maximum number o timers it supports, or 
>>> it naturally crashs when too much timers are created?
>>>
>>> In an test I am doing I have the following:
>>>
>>> #define CONFIGURE_MAXIMUM_POSIX_TIMERS 150
>>> #define CONFIGURE_MAXIMUM_ 150
>>>
>>> Then I have source code to create 100 timers, but when the program 
>>> starts it hangs, even before starting sreating the first timer. The 
>>> timers are created with the timer_create POSIX function.
>>
>>
>>
>> Sounds like the BSP was unable to assign the memory for that much
>> workspace.
> 
> 
> 
> I see this in confdefs.h (ss-20030417):
> 
> #define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
>  ((_timers) * \
>   ( 0 ) )
> 
> Maybe this is why?

That would explain it also. :)

I would guess that the proper definitions in
cpukit/sapi/include/confdefs.h should be:

#define CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \
   ((_timers) * sizeof(POSIX_Timer_Control))

And since POSIX timers implicitly use a Classic API timer:

#define CONFIGURE_MEMORY_FOR_TIMERS(_timers) \
   ((_timers + CONFIGURE_MAXIMUM_POSIX_TIMERS) * \
      ( sizeof(Timer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) )

My earlier statement about the bspstart.c failing still
apply.  But this time you probably got slightly further
in initialization before things failed.  RTEMS initialization
probably ran out of workspace duging the preallocation of
object control blocks.

If this works, let us know so a PR can be filed.

> Kamen
> 





More information about the users mailing list