I know that a linux process have two separate stacks - one in user space and other in kernel space. But where is the stack used by ISR ? Is it shared with a process's kernel space stack ?
1 Answers
In older times, the ISR used to be served using the current process's stack. So, when a interrupt happened, the current executing process would save all it's data on it's kernel or userspace stack and start executing the appropriate ISR function using it's own kernel stack.
But with the introduction of ISR stack, all the ISR related processing is done using a separate stack named ISR stack. ISR stack is in kernel space, as only kernel thread can execute the ISR handler of the interrupts.
The user space does not know and frankly does not care about whether the interrupt is served in current process's kernel stack or a separate ISR stack. As interrupts comes per cpu, therefore ISR stack has to be per cpu.
answering your original question : if ISR stack existes, it is completely different from process kernel stack. Otherwise, the process kernel stack is used for processing the interrupt.
Existence of ISR stack is also architecture depended.