What is the difference between a process and a thread?
Reported in Just Eat Takeaway.com European engineering loops. Fundamental operating-system question for entry-level engineering roles.
Interview scenario
Often asked in Just Eat Takeaway.com loops at European offices (London, Berlin, Amsterdam, Paris, Stockholm, Dublin, and remote EU). Prepare a clear spoken answer plus key trade-offs.
Model answer
Try answering aloud first
Cover trade-offs, structure, and a concrete example before revealing the baseline response.
How to frame this at Just Eat Takeaway.com: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.
A process is an independent program execution with its own virtual address space, file descriptors, environment variables, and process ID (PID). The OS scheduler treats processes as separate units of work with strong isolation—one crashing process does not corrupt another's memory.
A thread is a lightweight unit of execution within a process. Threads in the same process share heap memory and open files but have separate stacks and program counters. Creating and context-switching threads is cheaper than processes because they share address space.
Trade-offs: threads enable parallelism and responsive I/O within one app but require careful synchronization (locks, atomics) to avoid race conditions on shared data. Processes offer better fault isolation—common in browser tabs or worker pools handling untrusted code.
Mention practical patterns: thread pools for concurrent servers, multiprocessing when CPU-bound Python work must bypass the GIL, and async I/O when threads would block on network calls.
Discussion
Comments (0)
Share how this question came up in your loop, or add tips for others preparing.
Log in to comment on this question.