lkml.org 
[lkml]   [2001]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Task Switching in Linux
Jaswinder Singh wrote:
>
> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.020 / U:3.684 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site