linux process stack

All ,

I am beginner . Please see below my dobts

1. All process and kenel thread has their own task_struct structure
and kernel mode stack . Kernel itself maintain its own stack .


2 .Whenever a process ,say A , switch to kernel ( on system call )
,registers will be stored in its own kernel mode stack ?


3 . On interrupt , process A 's process context will be saved on
process A 's own kernel mode stack ?c


4 .Kernel thread will also use its own kenel mode stack on interrupt ?


5 .Where is the SP ( stack pointer ) is saved ? How it it retrieved back ?


Thanks,
Ratheesh
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
ratheesh k [ Sa, 15 Mai 2010 11:11 ] [ ID #2041495 ]

Re: linux process stack

On Sat, 15 May 2010 11:11:09 +0200, ratheesh k <ratheesh.ksz [at] gmail.com>=
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.

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

> 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 bac=
k?

It is saved on the kernel mode stack and is retrieved from there.

Note also that this may vary from architecture to architecture and
I'm not an expert.

--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=3D./ `o
| Computer Science, Micha=C5=82 "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)-- Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie"=
in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
m.nazarewicz [ Mo, 17 Mai 2010 12:08 ] [ ID #2041548 ]

Re: linux process stack

2010/5/17 Micha=C5=82 Nazarewicz <m.nazarewicz [at] samsung.com>:
> On Sat, 15 May 2010 11:11:09 +0200, ratheesh k <ratheesh.ksz [at] gmail.co=
m>
> 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 task=
s
> in this regard.
>
>> 5. Where is the SP (stack pointer) is saved? How it it retrieved ba=
ck?
>
> 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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Om Narasimhan [ Mo, 17 Mai 2010 18:55 ] [ ID #2041549 ]
Linux » gmane.linux.newbie » linux process stack

Vorheriges Thema: mmap of 8GB reserved memory using remap_pfn_range
Nächstes Thema: linux process stack