A process is an independent program that runs in its own memory space. A thread is a smaller unit of a process that shares the same memory with other threads in the same process.
On a single-core processor:
Only one task can run at a time. The CPU switches between processes or threads quickly (context switching) to give the appearance of parallelism.
On a dual-core processor:
Two tasks can truly run at the same time. One process or thread can run on each core, allowing real parallel execution.
Context switching:
Between processes, context switching is slower because each process has its own memory and system resources.
Between threads, context switching is faster because threads share the same memory, so less data needs to be saved and loaded.
Key differences:
Processes have separate memory; threads share memory.
Communication between processes is harder; between threads, it is easier.
Switching between processes takes more time than switching between threads.