What is the difference between a process and a thread?
Interview preparation resource from Gate Smashers.
A process is a protected resource container with its own address space, while a thread is an execution path inside that process. Threads share process resources but keep their own registers, program counter and stack.

Processes provide isolation. A failure in one process normally does not corrupt another process because their virtual address spaces are separate. Communication between processes therefore needs an IPC mechanism.
Threads are lighter because threads in the same process share code, heap and open files. This makes communication fast, but it also creates synchronization problems: one faulty thread can corrupt shared data or crash the complete process.
A web server illustrates the trade-off well. Multiple threads can handle requests efficiently because they share cached data, but access to that data must be synchronized. Separate processes provide stronger isolation, although communication and context switching are generally more expensive.
