Re: Kernel Stack and User Stack

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

 



In 2.6 this 8k space contains kernel stack at top and thread_info
structure at bottom, in 2.4 it was stack and task_struct structure.

Now in 2.6 thread_info is a compact structure (providing more space to
kernel stack) which further contains pointer to task_struct structure
in addition to some other info like preempt_count, exec_domain etc.

This 8k space is represented by thread_union structure, please refer
to the following links for more info.

http://lxr.linux.no/source/include/linux/sched.h#L806
http://lxr.linux.no/source/include/asm-i386/thread_info.h#L100

Gaurav


On 5/19/06, Manjunath Naik <peter.desouzain@xxxxxxxxx> wrote:


each process has an associated task_struct, which is used for process
managament. to allocate this struct, the kernel allocates 2 pages (normally,
but as mentioned, it can be only 1 page), which amounts to 8k, and places
the task_struct at the bottom.
each time the host goes from user space to kernel space (interrupt, system
call , etc...), these 2 pages are used for the kernel stack.
so, your module does not have a stack of it's own, but rather uses whats
available at the time of it's execution - either the 2 pages as i mentioned,
or the stack of a kernel thread which called it.

Source : http://kerneltrap.org/node/5416


On 5/18/06, abum@xxxxxxxxx <abum@xxxxxxxxx> wrote:
> Yes. There is also a per process kernel stack maintained by ernel.
>
> ~Abu
>
> > HI,
> > I am a newbie to linux kernel. I wanted to know that for every process
> > created in User Space
> > there is a separate stack created .Wat about the kernel stack , is it
> > separate for every process
> >
> > Thanks in advance,
> > Zaheer
> >
>
>
>
>
**************************Disclaimer************************************
> Information contained in this E-MAIL being proprietary to Aftek Infosys
Limited
> is 'privileged' and 'confidential' and intended for use only by the
individual
> or entity to which it is addressed. You are notified that any use, copying
> or dissemination of the information contained in the E-MAIL in any manner
> whatsoever is strictly prohibited.
>
***************************************************************************
> http://www.aftek.com/
>
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>




--
Gaurav
Email: gauravd.chd@xxxxxxxxx
--------------------------------------------
Read my Linux Kernel blog at: http://lkdp.blogspot.com/
--------------------------------------------

--
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