LOGBOOK

HELP

Quiz Entry - updated: 2026.07.07

What is a process and how does context-switching work?

A process is the OS's abstraction of a running program; rapidly saving one process's state and loading another's (a context switch) fakes parallelism on one core.

Six-step context switch: Process A running, then a timer interrupt or A blocking, then the kernel saving A's PC, registers, and flags to A's Process Control Block, then the scheduler picking B, then the kernel loading B's context from B's PCB, then Process B running. Costly because of a TLB flush and lost cache warmth.

* A context switch saves the running process's state to its control block and restores another's, an operation made costly by TLB flushes and lost cache warmth. *

Each process gets its own address space and the illusion of owning the machine. On a single core the OS interleaves them so quickly that they appear to run at once, switching whenever a timer fires or a process blocks waiting on I/O.

Process = running program with:

  • Its own address space
  • Illusion of exclusive hardware access

Concurrency types:

  • Multi-core: True parallelism (multiple CPUs)
  • Single-core: Apparent parallelism via context-switching

Context = everything needed to resume:

  • Program Counter (PC)
  • Register file contents
  • Memory contents
  • Open files

Context switch triggers:

  • Periodically (timer interrupt)
  • When process waits (I/O, sleep)

Threads: Lightweight processes sharing address space - easier data sharing, more efficient scheduling.

Go deeper:

From Quiz: REVE1 / Overview of Computer Systems | Updated: Jul 07, 2026