Re: difference between User space and Kernel space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have very much confusion about the difference
> between user space and kernel space.
> I mean as far as I know when a programme is executed
> i.e simple C prog. it contains three sections in
> memory such as gobal, data and text section.
> There is somthing called user stack and kernel stack
> there. whenever a process get the turn to be executed
> by the scedular its stack contain is copied to the
> kernel stack(correct me if I'm goin wrong.) 

The user-space stack never touches the kernel-space stack, see below for
further explanation.

> Now when we say we execute a system call it jumps to
> the kernel level. Now if we see the it by kernel stack
> when the stack frame is executed on which the call to
> system call is made, how come it jumps to kernel
> mode..

There are two stacks, one for the user-space space part of the process
and one for the kernel part. You cannot arbitrarily modify the kernel
stack of a process and there's no reason you should have to.
When your process running in user-space for example does a system call
the kernel will start using the kernel stack for the process.

When passing data between user-space and kernel the hardware registers
are used (at least for x86, but i think quite much everyone does
similar).

> Now related to this, we say kernel code doesnt have
> address space, now what does that mean..I mean to
> execute the code it has to have some memory on which
> to be reside and get executed..

There is an address space, it's just different from the address space
normally meant as referring to user-space.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux