The Runtime Theory
easyKernelFoundations#processes#threads#concurrency

What Is the Difference Between a Process and a Thread?

The interview answer covering memory isolation, creation cost, communication, and failure boundaries.

TRT practice prompt — not a verified question from a named employer.

The Runtime Theory Team1 min read

What Is the Difference Between a Process and a Thread?

Question: What is the difference between a process and a thread?

Core Answer

A process is an independent program in execution with its own memory space. A thread is a lightweight unit of execution that shares its parent process's memory space.

The Key Difference: Memory

AspectProcessThread
Memory spaceSeparate address space per processShares the process's address space
IsolationHardware-enforced by the MMUNone — threads share all memory
ProtectionOne process crashing cannot affect anotherA bug in one thread can crash all threads

Because threads share memory, they communicate by reading and writing shared variables. This is fast but requires synchronization (locks, mutexes, semaphores) to prevent race conditions. Processes communicate via IPC (inter-process communication) — pipes, message queues, shared memory — which is slower but safer.

Creation Cost

Process creation is expensive. The kernel must:

  1. Allocate a Process Control Block (PCB)
  2. Create a new page table (or set up copy-on-write)
  3. Duplicate file descriptors
  4. Initialize the CPU register state

Thread creation is cheaper because the kernel reuses the existing memory space. It only needs to:

  1. Allocate a thread stack (~8MB virtual, less physical)
  2. Allocate a Thread Control Block (TCB)
  3. Set up initial register state

This is why web servers often use a hybrid model: a process per CPU core (for isolation) with threads within each process (for concurrency).

Failure Isolation

If a process crashes (e.g., segmentation fault), only that process dies. Other processes are unaffected. If a thread crashes, the entire process — and all its threads — die.

Further Reading

This answer walks

Practice follow-ups

  1. 01Why are threads cheaper to create than processes?
  2. 02What happens when one thread crashes in a multi-threaded process?
  3. 03When would you choose processes over threads for a web server?

More interviews in this topic

One dispatch a week

The trace behind each question, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save