Difference between Process and Thread
An OS fundamentals question every backend engineer must nail.
Question
What is the difference between a process and a thread?
Answer
A **process** is an independent execution unit with its own memory space, file descriptors and system resources. A **thread** is a lightweight execution unit *inside* a process that shares memory with sibling threads. Processes are isolated (crash of one doesn't affect others) but expensive to create and communicate between (IPC required). Threads are cheap and can share state directly, but a bug in one can corrupt the entire process, and shared state requires synchronization (locks, atomics).
See question and answer above.
Keep reading
You may also like
interview
How does Terraform know what already exists?
The most missed Terraform interview follow-up. Explain state files and how they work.
interview
Explain the Kafka message flow end-to-end
A crisp walkthrough of what happens between a producer's `send()` call and a consumer's `poll()` receiving the message.
interview
Difference between Docker and Kubernetes
One of the most common early-career interview questions. Nail the answer in 3 sentences.
Discussion (0)
No comments yet. Be the first to weigh in.