Question-1 Explain Process Control Block (PCB).
PCB (Process Control Block):
- To implement the process model, the operating system maintains a table (an array of structures) called the process table, with one entry per process, these entries are known as Process Control Block.
- Process table contains the information what the operating system must know to manage and control process switching, including the process location and process attributes.
- Each process contains some more information other than its address space. This information is stored in PCB as a collection of various fields. Operating system maintains the information to manage process.
Various fields and information stored in PCB are given as below:
- Process Id: Each process is given Id number at the time of creation.
- Process state: The state may be ready, running, and blocked.
- Program counter: The counter indicates the address of the next instruction to be executed for this process.
- CPU registers: The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers,and general-purpose registers, plus any condition-code information. Along with
- the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward.
- CPU-scheduling information: This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters.
- Memory-management information: This information may include such information as the value of the base and limit registers, the page tables, or the segment tables, depending on the memory system used by the operating system.
- Accounting information: This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.
- Status information: The information includes the list of I/O devices allocated to this process, a list of open files, and so on.
- Figure above shows some of the more important fields in a typical system.
- The fields in the first column relate to process management.
- The other two columns relate to memory management and file management, respectively.
In practice, which fields the process table has is highly system dependent, but this figure gives a general idea of the kinds of information needed