Re: linux process stack

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

 



2010/5/17 Michał Nazarewicz <m.nazarewicz@xxxxxxxxxxx>:
> On Sat, 15 May 2010 11:11:09 +0200, ratheesh k <ratheesh.ksz@xxxxxxxxx>
> wrote:
>>
>> 1. All process and kenel thread has their own task_struct  structure
>> and kernel mode stack . Kernel itself maintain its own stack .
>
> I'm not sure about kernel's own stack but otherwise it's correct.
If thread_info size is 8k, then kernel does not have a separate stack.
If it is 4k(1page), then kernel has exception and interrupt stacks,
which are not a part of thread_info.

>
>> 2. Whenever a process, say A, switch to kernel (on system call),
>> registers will be stored in its own kernel mode stack ?
>
> Yes.
>
>> 3. On interrupt, process  A's process context will be saved on
>> process A's own kernel mode stack?
>
> No.  On interrupt context is not switched.  Interrupt is run in
> a context of a task that was running so only registers are saved same
> as with system call.
Unless thread_info is 4k.
>
>> 4. Kernel thread will also use its own kenel mode stack on interrupt?
>
> As far as I know, kernel threads are in no way special from user tasks
> in this regard.
>
>> 5. Where is the SP (stack pointer) is saved?  How it it retrieved back?
>
> It is saved on the kernel mode stack and is retrieved from there.
Correct. But it can be more complex than that when exceptions occur
and exception handler is to be run in user mode.
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" 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.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux