What is the difference between kernel stack and user stack?

前端 未结 7 509
忘了有多久
忘了有多久 2021-01-31 06:25

What is the need of using two different stacks in same program? How does trap change the current stack of program from user stack to kernel stack? How does it come back to user

7条回答
  •  走了就别回头了
    2021-01-31 07:02

    One of the reasons for having a separate kernel stack is that the kernel needs a place to store information where user-mode code can't touch it. That prevents user-mode code running in a different thread/process from accidentally or maliciously affecting execution of the kernel.

提交回复
热议问题