* init_task belongs to "process 0" or "process 1"?
@ 2010-01-04 8:07 Shivdas Gujare
2010-01-05 7:32 ` Nobin Mathew
0 siblings, 1 reply; 5+ messages in thread
From: Shivdas Gujare @ 2010-01-04 8:07 UTC (permalink / raw)
To: linux-kernel; +Cc: Shivdas Gujare
Hi all,
I am trying to understand the role of linux kernel "process 0" i.e. swapper.
I am not able to understand, where it gets started? and Does
"init_task" from arch/arm/kernel/init_task.c belongs to "swapper" or
"init"?
whats the purpose of "init_task"?
Thanks for your help.
Thanks and Regards,
Shivdas Gujare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: init_task belongs to "process 0" or "process 1"?
2010-01-04 8:07 init_task belongs to "process 0" or "process 1"? Shivdas Gujare
@ 2010-01-05 7:32 ` Nobin Mathew
2010-01-05 15:52 ` Chris Friesen
2010-01-10 20:58 ` Leonidas .
0 siblings, 2 replies; 5+ messages in thread
From: Nobin Mathew @ 2010-01-05 7:32 UTC (permalink / raw)
To: Shivdas Gujare; +Cc: linux-kernel
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.
Init task is process 1 which is initially a kernel thread created from
process 0 using copy_process(), then it does an execv() (/sbin/init )
or similar one to create the normal process init.
Name given to process 0 is swapper.
.comm = "swapper"
On Mon, Jan 4, 2010 at 1:37 PM, Shivdas Gujare <shivdas.tech@gmail.com> wrote:
> Hi all,
>
> I am trying to understand the role of linux kernel "process 0" i.e. swapper.
> I am not able to understand, where it gets started? and Does
> "init_task" from arch/arm/kernel/init_task.c belongs to "swapper" or
> "init"?
> whats the purpose of "init_task"?
>
> Thanks for your help.
>
> Thanks and Regards,
> Shivdas Gujare
> --
> 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/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: init_task belongs to "process 0" or "process 1"?
2010-01-05 7:32 ` Nobin Mathew
@ 2010-01-05 15:52 ` Chris Friesen
2010-01-10 20:58 ` Leonidas .
1 sibling, 0 replies; 5+ messages in thread
From: Chris Friesen @ 2010-01-05 15:52 UTC (permalink / raw)
To: Nobin Mathew; +Cc: Shivdas Gujare, linux-kernel
On 01/05/2010 01:32 AM, Nobin Mathew 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.
>
> Init task is process 1 which is initially a kernel thread created from
> process 0 using copy_process(), then it does an execv() (/sbin/init )
> or similar one to create the normal process init.
>
> Name given to process 0 is swapper.
> .comm = "swapper"
Oddly enough, this name makes no sense anymore. Why don't we call
process 0 "idle"?
Chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: init_task belongs to "process 0" or "process 1"?
2010-01-05 7:32 ` Nobin Mathew
2010-01-05 15:52 ` Chris Friesen
@ 2010-01-10 20:58 ` Leonidas .
2010-01-11 12:23 ` Nobin Mathew
1 sibling, 1 reply; 5+ messages in thread
From: Leonidas . @ 2010-01-10 20:58 UTC (permalink / raw)
To: Nobin Mathew; +Cc: Shivdas Gujare, linux-kernel
> 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?
-Leo.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: init_task belongs to "process 0" or "process 1"?
2010-01-10 20:58 ` Leonidas .
@ 2010-01-11 12:23 ` Nobin Mathew
0 siblings, 0 replies; 5+ messages in thread
From: Nobin Mathew @ 2010-01-11 12:23 UTC (permalink / raw)
To: Leonidas .; +Cc: Shivdas Gujare, linux-kernel
On Mon, Jan 11, 2010 at 2:28 AM, Leonidas . <leonidas137@gmail.com> 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.
See
do_boot_cpu()
|
do_fork_idle()
|
fork_idle()
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.
Nobin.
>
> -Leo.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-11 12:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 8:07 init_task belongs to "process 0" or "process 1"? Shivdas Gujare
2010-01-05 7:32 ` Nobin Mathew
2010-01-05 15:52 ` Chris Friesen
2010-01-10 20:58 ` Leonidas .
2010-01-11 12:23 ` Nobin Mathew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox