Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Limit To # of Tasks Running

Posted by Nobody/Anonymous on 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


RE: Limit To # of Tasks Running

Posted by Richard on 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.


RE: Limit To # of Tasks Running

Posted by Richard on October 21, 2005
Forgot to actually answer the question - yes the number of tasks is only limited by the amount of RAM.


RE: Limit To # of Tasks Running

Posted by Colin Tan on 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 ?


RE: Limit To # of Tasks Running

Posted by Dave on 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.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner