Brendan Ang

Search

Search IconIcon to open search

Context Switch

Last updated Nov 8, 2022 Edit Source

# Context Switch

OS preserves the state of the CPU by backing up the whole state of the task, including the call stack, storing registers and the program counter.

Context switch time is overhead: note that there is time spent where both processes are idle As the call stack can be vary large, the OS typically sets up a separate call stack for each task instead of having to back up the entire call stack content on each task switch. Such a task with its own call stack is a thread.