8498
is the main process8499
and 8500
are the threadsThe Process Control Block is a data structure which holds the information related to a process.
The kernel keeps track of all PCBs in a process table
A process can be in one of the following states
A process that is in the READY state is often as a result of that process using up its allocated execution time
A process that is in the BLOCKED state is often as a result of the process waiting for some IO request
A unit of execution of a process
Each thread has its own stack, where local variables for that thread are stored. (The heap is shared between all threads of a process.)
Like how a process has a PCB, a thread has a Thread Control Block (TCB).
These contain thread-related data (i.e. thread program counter, registers, stack and state)
Threads can be created by the kernel.
This gives the responsibility of managing threads to the operating system.
syscall
Programs can also create self-managed threads.
This is useful in cases where custom thread management functionality is desired.
This is often however difficult to implement, and does not take advantage of the whole system
syscall
will block the entire processProcesses are independent of each other, and have their own dedicated memory and resource allocation.
Threads of a process share the allocated resources.
Processes | Threads | |
---|---|---|
Memory | Independent | Shared |
Resources | Independent | Shared |
Crash | Independent | Shared |