Re: Why two stacks per process?

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

 



>pre-process "thread_info" structure at the bottom of the >kernel stack.
>in short, that per-process stack has to exist the whole time >the
>process does, since it's actually keeping track of some >process
>information.  you couldn't do that if you just used the >user-space stack.

Why could not we do that in case of one stack?
Ok. Thread_info structure is stored in this way so that you can access it directly through stack pointer. Which gives a performance improvement. And again thread_info is stored in this way because there is a kernel mode stack concept for each process. If there is no kernel mode stack you can store thread_info like you store task_struct. task_struct is also required for the entire life time of the process.

I feel there are two stacks for security reasons but I dont know what they are precisely.

- A Sahlot


On Thu, Apr 24, 2008 at 7:05 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
On Thu, 24 Apr 2008, sahlot arvind wrote:

> Yes. I agree with Robert. There are two stacks per process. But why
> cannot we just use one stack as I said earlier?

while there may be other reasons, there's one obvious one -- as i
mentioned in my earlier email, the kernel likes to store a small,
pre-process "thread_info" structure at the bottom of the kernel stack.
in short, that per-process stack has to exist the whole time the
process does, since it's actually keeping track of some process
information.  you couldn't do that if you just used the user-space
stack.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
   Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================



--
http://linuxexplained.blogspot.com

[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