Eli Carter wrote: > > Joseph A Knapka wrote: > > > > Anumula Venkat wrote: > > > > > > U are talking about stack used by kernel when a > > > context switch takes place in a process. I am talking > > > about Kernel Modules which completely runs in > > > KERNEL MODE. If u have answer to this question please > > > write to me. > > > > I answered it. Every time code in your kernel module > > executes, it is doing so on behalf of some process. > > Whether that process is a user-mode process that > > has entered kernel mode for some reason, or is a > > kernel thread, it is still a process in kernel mode > > that executes on the current kernel stack. ALL CODE > > in the Linux kernel, other than the boot code that > > runs before init starts, is running in the context > > of some process. The only difference between kernel > > threads and user processes is that a kernel thread > > -always- executes in kernel mode, using its kernel > > stack and the kernel's pagetables. > > Well, I'm not sure that's accurate... what about interrupt handlers? > There is something called "interrupt context" where kernel code is > executed, but _not_ on behalf of some process (think receive of a packet > for instance). There may be some random process that has been > interrupted, but you don't know what process it is. When something like > read() or open() is called, then you are in a process context. Even interrupt handlers are running in the context of (though as you say, -not- on behalf of; I misspoke in my earlier message) the current task. You're still, as far as I know, running on the kernel stack of the current process (of course, returning from the interrupt cleans the stack, so the task never notices an interrupt handler has used it). I don't think Linux implements a separate stack for interrupt handlers to use, though I haven't looked at the relevant code. Cheers, -- Joe -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/