Keil Logo


The following options can be configured:

  • OS_TASKCNT specifies the maximum number of tasks that can be active at the same time. This includes tasks in any state (running, waiting, or ready) other than the INACTIVE state.

    This information is used by the RTX kernel to reserve the memory pool for the task control variables. This number can be higher than the number of defined tasks in your application (one task can run in multiple instances) or lower if it is guaranteed that the number of created and running tasks will never exceed OS_TASKCNT.

    #define OS_TASKCNT     6
  • OS_PRIVCNT specifies the number of tasks with user-provided stack.

    By default, the RTX kernel allocates a fixed size stack to each task. However, the stack requirement can vary widely between tasks. For example, if a task's local variables include large buffers, arrays, or complex structures, then the task requires a lot more stack. If such a task tries to use more stack than the allocated stack, it might overwrite the stack of neighboring tasks. This is because the fixed size stacks of the tasks are part of the common system stack and are contiguous. This leads to malfunctioning of the RTX kernel and is likely to cause a system crash. An intuitive solution to this problem is to increase the fixed stack size. However, this increases the stack size of every other task that might not need the extra stack. To avoid this wastage of valuable resource, a better solution is to allocate a separate user-provided stack for tasks that require a lot more stack.

    The term user-provided, in this case, means that the memory space for the task's stack is provided by the user when the task is created. It is not automatically assigned by the kernel. The RTX kernel uses OS_PRIVCNT to optimize the memory usage. The kernel will not reserve stack space for the tasks with a user-provided stack.

    #define OS_PRIVCNT     0


  • In addition to OS_TASKCNT user tasks, the system creates one system task os_idle_demon. This task is always required by the RTX kernel. Total number of concurrent running tasks is OS_TASKCNT+1 (number of user tasks plus one system task).
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.