Skip to contentSkip to conversation

Task Switching in Linux

DISCUSSION Jaswinder Singh 2 participants 2 messages Jun 11, 2001

lore
Share & tools
lore
#0 lore raw

In Linux , If we assume that there are only 2 tasks A and B and both are equal , this is correct or not :-

TASK A -> schedule -> switch_to -> TASK B -> schedule -> switch_to -> schedule -> switch_to -> TASK A.

Thank you,

Best Regards,

Jaswinder.
--
These are my opinions not 3Di.

#1 lore raw
Quoted 7 lines · Jaswinder Singh

In Linux , If we assume that there are only 2 tasks A and B and both are equal , this is correct or not :-

TASK A -> schedule -> switch_to -> TASK B -> schedule -> switch_to -> schedule -> switch_to -> TASK A.

Heck no. TASK A will be run until it either blocks or its time quantum drops below TASK B's. It does not matter how many times it calls schedule(), 'cept its a darn waste of time.

Now, it you call sched_yield() your chances are higher, but still no guarantee. If you get the tasks out of SCHED_OTHER sched_yield() will do the above (if they have the same priority).

George