[lkml]   [2010]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: init_task belongs to "process 0" or "process 1"?
On Mon, Jan 11, 2010 at 2:28 AM, Leonidas . <> wrote:
>> init_task is the head of doubly linked list which holds all
>> task_structs in the system. init_task is again the task_struct for
>> process 0/swapper/idle task. This process is created manually (I meant
>> to say not by copy_process() calls). Manually means they are static
>> structures defined in the code (see INIT_TASK, init_mm, init_fs etc).
>> There will be multiple idle task if there is more than 1 cpu core.
>> Idle task is the one which is scheduled if there is no other task
>> ready for scheduling.
> An idle task per core? So these tasks must be having different pids
> right? As per my understanding there is only 1 idle task, in that case
> on multiple cores when there is no activties on more than one cores,
> how things would work? Same task cant be stored on different cores at
> the same time right?
> How is this handled?

Yes there is one idle task per core and all idle task have the same pid 0.
once they are created they are directly put into per cpu runque,
runqueue has a member called idle
which is of type struct task_struct.


only the idle task in the first cpu core is created manually, all the
idle tasks in other cpu core is created using copy_process i.e.
copying the original idle task.

Correct if I am wrong.


> -Leo.

 \ /
  Last update: 2010-01-11 13:27    [W:0.058 / U:1.236 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site