CS161 2019-02-05
Zhu, Justin

CS161 2019-02-05
Tue, Feb 5, 2019


Context switching means changing between different hardware resources.

Intentional context switch: System call, which transfers control to the kernel. Traps

Unintentional context switch: Interrupt or faults or other exceptions

To perform a context switch, we save a state, which saves registers of the old task.

Kinds of context

Each kernel task context has its own kernel stack, which holds local variables and registers of a task.

Question: When the processor is running a kernel task, the %rsp register points into the corresponding stack. What is the corresponding stack in memory.

Kernel task suspension requires more memory. Otherwise, user threads block and kernel state must be managed by the kernel programmer.