lkml.org 
[lkml]   [2005]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: How does 2.6 SMP scheduler initially assign a thread to a run queue?
Date

>
> In the 2.6 kernel, there is one run queue per CPU, in case of an SMP.
> After a thread is created, how does the scheduler determine which run
> queue it goes to?

First it forked process (child) gets the same CPU as that of parent.
forking a child gets the same CPU and later part of fork will call
wake_up_new_task () to fetch the run-queue of the CPU and
__activate_task () is called to move task into run-queue.
Later rescheduling of the process may move process to another
run-queues.

>I know that once it goes to a particular run queue,
> the scheduler would try to run that thread on that CPU to take
> advantage of processor affinity; and then there would be the load
> balancing stuff. But at the very beginning, what algorithm does the
> scheduler use to assign a newly created thread to a particulat CPU?

Child will always goes to the parent's run-queue (CPU) for the first time.

> Would the load balancing algorithm be used? Or gang scheduling?

Yes, load balancing algorithm is used. tasks will be pulled from
very busy processors to lesser busy processors.

> By the way, in an SMT/hyperthreading processor, does the latest kernel
> version assign one run queue per physical CPU, or per virtual
> processor?
>

one run-queue per physical CPU

regards
lk

-
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-06-08 14:45    [W:0.059 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site