Reference · OS / Processes / Threads

OS / Processes / Threads — Cheat Sheet

Pairs with Lesson 5: Blocking I/O and Scheduling.

Glossary

TermMeaning
ProcessAn isolated unit of execution with its own memory space, file descriptors, and address space. One process cannot see into another's memory directly.
ThreadA unit of execution within a process. Threads in the same process share that process's memory; each thread keeps its own stack and register state.
Context switchThe OS saving the currently running thread's registers and stack pointer, then loading a different thread's saved state so it can resume. Has real but small overhead compared to the I/O wait it enables.
Blocking syscallA system call (e.g. read() on a socket with no data yet, a disk read) that cannot return immediately. The kernel parks the calling thread instead of spinning the CPU on it.
SchedulerThe kernel component that decides which runnable thread gets to run on which core next, and moves threads between states as syscalls block, I/O completes, or time slices expire.
RunningThread state: actually executing on a CPU core right now.
RunnableThread state: ready to execute, just waiting for the scheduler to give it a core.
Blocked / waitingThread state: waiting on something external (I/O, a lock, a timer). Not eligible to run even if a core is free. An interrupt moves it back to runnable when the wait ends.
I/O-bound workloadWork where threads spend most of their time blocked on network or disk, not computing. Benefits from more concurrency than the core count.
CPU-bound workloadWork where threads spend most of their time actually running on a core. Adding more threads than cores just adds context-switch overhead, not throughput.

The core decision rule

More threads than cores — does it help?

More threads than cores helps only if the extra threads spend most of their time blocked on I/O, not computing. If they're mostly running (CPU-bound), extra threads past the core count just get time-sliced against each other — more context switching, no more actual throughput.

Primary source