Limit To # of Tasks Running

nobody wrote on Friday, October 21, 2005:

Are the number of tasks basically limited to the amount
of available memory?

Any plans for a memory manager that can realloc stale
memory?

Thanks.

rtel wrote on Friday, October 21, 2005:

The memory schemes provided are just examples as different applications have very different requirements (as per the text on the memory management documentation page).

The heap2 scheme will reuse memory, but it will not consolidate fragmented blocks into single large blocks.  To do so would increase the code size and execution time, and make the execution time more non deterministic.  This is ok of coarse for some application but definitely not for others.

Heap2 can be used if the memory being allocated and freed is always of the same size as then fragmentation should not occur.  The death sample files that create and delete tasks use heap2 as the stack of the tasks is always the same size.

Regards.

rtel wrote on Friday, October 21, 2005:

Forgot to actually answer the question - yes the number of tasks is only limited by the amount of RAM.

Regards.

floppel wrote on Monday, February 16, 2009:

Hi Richard,

I have a little problem with the maximum number of tasks perhaps you could shed some light.

I am developing on both the LPC2109 and LPC2104. To test out the tasks I have the flash task flash multiple LEDs. So far for both boards I can only manage to create 3 tasks before the board refuses to respond. I can increase the number of tasks however by reducing the minimum stack size.

What could be limiting the number of tasks? If it is the RAM why is it the LPC2104 is also limited to 3 ?

Thanks
Colin

davedoors wrote on Monday, February 16, 2009:

It depends on which heap implementation you are using.

Each time you create a task the stack for the task is allocated. When you run out of RAM the stack cannot be allocated and the task cannot be created.

To be able to create more tasks reduce the stack size so less is allocated each time or increase the amount of RAM available. This is normally done by increasing configTOTAL_HEAP_SIZE in FreeRTOSConfig.h but this depends on the heap you are using. See http://www.freertos.org/a00111.html for more information.