DSA Factory
Free Processes and threads lessonsProcesses and threads · Stage 0 · States and switching · Step 2

The context switch

See exactly what is saved and restored when the CPU changes process, and what it costs. About 12 minutes.

Quick check

What does a context switch have to save and restore?

  1. AThe CPU state: program counter, registers and memory-map pointers
  2. BThe whole contents of the process's memory
  3. CThe process's files on disk
Show the answer

The CPU state: program counter, registers and memory-map pointers. That is all that lives inside the CPU; memory itself stays in place.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve