Operating system context switch

Context switching is the process by which the operating system switches from one running process or thread to another . During context switching, the operating system saves the running state (also called the context) of the current process or thread and restores it to the next process or thread to be executed.

During context switching, the information that the operating system needs to save and restore includes:

  1. The value of CPU registers : including program counter, stack pointer, general-purpose registers, etc.
  2. Process or thread status information : including process or thread identifier, priority, status, etc.
  3. Memory management information : including process or thread address space information, page tables, etc.
  4. File descriptors and other resource information : including open files, network connections, timers, etc.

Guess you like

Origin blog.csdn.net/csxylrf/article/details/130449891