Last time I wrote about the Process and it memory layout and now I will be writing about how a process is represented in operating systems and what are threads.
Process Control Block
A Process Control Block or a Task Control Block is how the operating system represents a process. A PCB contains following pieces of information in it.
- Process State. As mentioned in the last post a process can be in a new, running, terminating, waiting or in ready state.
- Program Counter. The counter holds the address for the next intruction to be executed for the process.
- CPU Registers. The CPU register vary depending on the type for CPU architecture and store the state information when an interrupt occurs so the porcess can be continued correctly after the interrupt is handled.
- CPU-scheduling Information. This contains the pointers to process and scheduling information about the processes.
- Memory Management Information.
- Accounting Information. This stores the information about the CPU usage and account number, jobs or process numbers etc.
- I/O Status Information. This stores the information about the currently open files and the I/O devices in use at the time.