• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

why operating system use separate stack ?

Jincuteguy

Senior member
You know when a process executes a TRAP or is interrupted, the operating system uses a separate stack to execute any operating system code rather than the stack of the current process. Anyone know why the operating systems designers select this type of implementation?
 
If you used the stack of the process, you couldn't put "sensitive" data on the stack, or it would be readable when you return to the process... and the OS itself wants to have a consistent stack. If it only used the stacks of the processes, it couldn't rely on the data being preserved, and some data doesn't apply to only one process. Such data belongs in the stack for the os "process" (I know that's the wrong word, but you get the idea). This sounds like a "do my homework for me" question.
 
Each process (actually, each thread) has a separate stack. Which is necessary, since in most OSes each process runs in an isolated virtual address space.

Moreover, in the NT operating systems, each thread actually has two stacks: one kernel mode stack and one user mode stack. This is required because kernel mode components can't touch user mode address space in certain situations (such as when the processor's IRQL is above DISPATCH level).

The reasons are quite technical but also quite valid.

I recommend "Inside Windows 2000, Third Edition" by Solomon and Russinovich if you're interested in learning more about this.
 
Back
Top