What is the difference between kernel stack and user stack?

前端 未结 7 678
忘了有多久
忘了有多久 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 06:54

    The context of a process (psw, state of registers,pc...) is saved in the PCB of the process, in the kernel space of memory, not in the stack. Yes, there is one stack for each user process and more, one stack for each thread in the user space memory. In the kernel, the data structures are shared by the multiples codes of the function in the kernel. The stack is used for the call of procedure and for the local variables, not for saving the context.

提交回复
热议问题