Search code examples
rtosfreertos

Does STACK_SIZE of a task affect the task switching delay


If i have two tasks TASK_A and TASK_B.

Stack size of TASK_A = 300

Stack size of TASK_B = 600

Does context switching time for TASK_A and TASK_B have any dependency on their respective stack size.


Solution

  • No, task stack size does not effect context switching time. Each task has its own stack in an separate range of memory. During a context switch, the processor's stack pointer register is changed to point to a different task's stack. The stacks are not copied or moved during a context switch so the stack size does not effect context switching time.