Each process is responsible for saving and restoring its registers when it loses and gains the processor. The kernel notifies a process that it is about to gain or lose the processor by calling the processes' prologue and epilogue code. The locations of this code is set in the processes u-area.
Currently, this code does things like save and restore registers,
check for timer time-outs, and check for signals.