EMZETT.
Login

Process scheduling

In short: The operating system’s scheduler decides which process or thread may run on a processor core when and for how long. The goal is a mix of fairness, throughput and short response time.

In more detail: With time slices (round robin) each thread runs briefly, then the kernel switches to the next via a context switch. Priorities favour important tasks. Modern kernels use complex methods such as Linux’s Completely Fair Scheduler (CFS).

In Depth

  • Context switch: Save/load registers and state. Costs time and flushes caches.
  • Preemptive vs. cooperative: The kernel can interrupt threads, or they yield voluntarily.
  • Priorities and nice: Influence the CPU share.
  • Real-time scheduling: Hard deadlines (for example robotics, audio).
  • Starvation: Low priorities never get a turn. Remedy: aging.
  • Priority inversion: A low task holds a lock a high one needs.
  • Multicore: Load balancing between cores and respect for cache affinity.

See also: Virtual memory and paging, System calls and kernel mode