Process vs thread: what is the difference?
A process is an independent program in execution with its own memory space; a thread is a unit of execution within a process. A process can contain multiple threads that share the process memory (heap, globals) while each keeps its own stack and registers.
The consequences: threads are cheaper to create and switch between, and they communicate easily through shared memory — but that sharing is also the danger, requiring synchronisation (locks, mutexes) to avoid race conditions. Processes are isolated, so a crash in one does not corrupt another, but inter-process communication (pipes, sockets, shared memory segments) is heavier.
A solid interview summary: threads share memory and are lightweight but need careful synchronisation; processes are isolated and robust but more expensive to coordinate. Choose threads for concurrent work that shares state within one app, and separate processes for isolation, fault tolerance, or to sidestep limits like a single-threaded runtime.