FREE LESSON · Operating systems & runtimes · 1 OF 4

Process vs Thread: Scheduling and Concurrency

Processes, threads, and the scheduler — Many streams of work share finite processors

A process owns an isolated resource context; a thread is a schedulable execution stream within it.

Threads in one process commonly share code, heap, and open resources while keeping registers and stacks of their own. The scheduler chooses runnable threads for available cores, preempts them to share time, and leaves blocked threads asleep until an event makes progress possible.

Concurrency is about overlapping lifetimes; parallelism is simultaneous execution. You can have either without the other.

A context switch changes whose state is live

The kernel preserves the outgoing thread’s architectural state, updates accounting and address-space context if needed, selects a runnable successor, and restores its state. Cache and translation state may no longer match the new workload, so a switch has indirect costs beyond saving registers.

Fairness, latency, throughput, and locality pull scheduling policy in different directions.
Open this lesson in the interactive course →