What is the difference between a process and a thread?
A process is a running program with its own virtual address space, code, data, heap, open file descriptors and at least one thread. The operating system isolates processes from one another, so a crash in one usually does not corrupt another.
A thread is the unit of scheduling inside a process. Threads in the same process share the address space, heap, globals and file descriptors, but each has its own stack, registers and program counter.
Process A
code + data + heap + file table
thread 1 (stack, regs) thread 2 (stack, regs)
Because threads share memory, communication is cheap but synchronisation is required; a data race can corrupt shared state. Processes are isolated, so they are safer but communicating between them needs IPC such as pipes, shared memory or sockets, which is slower and more complex. Creating a process is heavier than creating a thread, so thread pools are common for handling many concurrent requests.