Context switch
• When a process is running, its hardware state (PC, SP,
regs, etc.) is in the CPU
• The hardware registers contain the current values
• When the OS stops running a process, it saves the current
values of the registers into the process’ PCB
• When the OS is ready to start executing a new process, it
loads the hardware registers from the values stored in
that process’ PCB
• The process of changing the CPU hardware state from
one process to another is called a context switch
• This can happen 100 or 1000 times a second!