Re: question : is the init process of kernel running in kernelspace or user space?

From: Steven Rostedt
Date: Mon Apr 18 2005 - 07:57:17 EST


On Mon, 2005-04-18 at 09:36 +0800, Tomko wrote:
> Hi all,
>
> In the linux system , kernel is often starting up like this :
>
> bootloader -> start_32() -> start_kernel() -> init()
>
> i would like to ask what is the piority level in this starting procedure
> ? 0 or 3 ? that means, this start up process are running in kernel space
> or user space ? or the level is keep changing ?
> If it is in kernel space from the very beginning , at which point the
> system is switched into user space ? is it at the time when kernel open
> the shell ?
>

All the above functions you mentioned are running in kernel space. The
point that init switches to user space is at the bottom of the init
function, when it calls run_init_process, which calls execve. Which is
the same execve that a user program calls, and at that point the execve
would switch the process to a user space program, usually /sbin/init.

Also, the term priority is somewhat ambiguous. The priority level of a
task in linux is defined as the strength it has in respect to other
tasks when it comes down to scheduling. I understand you are talking
about the x86 level that a process runs in (kernel or user) but not all
architectures use that, and linux is a multiple architecture OS.

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/