Characteristics of processes and threads
Processes |
Threads |
An operating system process requires a lot of 'overhead':
- process-ID, process group-ID, user-ID, and group-ID
- environment variables
- current working directory
- program instructions
- registers, stack space, heap space,
- file descriptors
- asynchronous signal actions
- libraries shared with other processes
- inter-process communication channels (message queues, pipes, semaphores, shared memory).
|
While threads all share their process's resources,
they can be scheduled and execute independently
because they duplicate only the essential resources:
- registers
- stack pointer (to own stack), heap is shared
- scheduling properties (such as a timeslice or a priority)
- set of pending and blocked signals
- thread specific data.
|
CITS2002 Systems Programming, Lecture 20, p5, 9th October 2023.
|