Process vs Thread
Contrast processes and threads in an OS. How does this affect isolation and memory?
Answers use simple, clear English.
Audio N/AQuick interview answer
A process is an isolated execution environment with its own virtual address space. Threads share the same address space within a process, making data sharing easy but races more likely. Process crash isolation is stronger; thread creation is cheaper.
Detailed answer
A process is an isolated execution environment with its own virtual address space. Threads share the same address space within a process, making data sharing easy but races more likely. Process crash isolation is stronger; thread creation is cheaper. Containers usually isolate processes via namespaces/cgroups, not by inventing a new CPU mode. Green threads / async tasks are userspace concurrency, not OS threads.
Full explanation
Green threads / async tasks are userspace concurrency, not OS threads.
Real example & use case
Choosing multi-process Node cluster vs worker threads for CPU-bound image processing.
Pros & cons
Pros of processes: isolation. Cons: IPC overhead. Pros of threads: shared memory speed. Cons: synchronization bugs.