In general, the operating system must save the state of the currently runningprocess and restore the state of the process scheduled to be run next. Saving the state of a process typically includes the values of all the CPU registers in addition to memory allocation. Context switches must also perform many architecturespecific operations, including flushing data and instruction caches.