tags:

views:

639

answers:

1

If there are 3 tasks(T1,T2,t3) with priority P1 P2 P3.

P1 is pended.

Assume that task P2 is doing some computation. During its execution, it wants to Yield the CPU to other tasks in the system.

Will TaskDelay(0) still works in this condition? or it works only when all the tasks are with same priority?

Regards, Prabhu

+3  A: 

taskDelay(0) will not cause a lower priority task to take control of the CPU.

Only if a task at the same priority is ready to execute would taskDelay(0) cause a context switch.

taskDelay(0) essentially causes a task at priority x to be put at the end of the priority x ready queue. If it is the only task at that priority, it retains the CPU.

Benoit