- Multiple activities going on at once with the ability to share an address space
- Lighter weight than processes, easy to create and destroy.
- Overlap activities with substantial I/O to speeding up the application.
- Useful on systems with multiple CPUs.
Three ways to construct a server
- Thread. Parallelism, blocking system calls.
- Single-threaded process. No parallelism, blocking system calls.
- Finite-state machine. Parallelism, nonblocking system calles, use interrupts to simulate thread.
Classical Thread Model
Processes are used to group resources together; threads are the entities scheduled for execution on the CPU. There are no protection betwwen threads because (1) it’s impossible, and (2) it should not be nessessary.
While threads share one memory space, it takes fewer space to maintain a thread, including Program Counter, Registers, Stack and State.