Process control block
Encyclopedia
Process Control Block is a data structure in the operating system
kernel containing the information needed to manage a particular process. The PCB is "the manifestation of a process in an operating system".
During context switch
, the running process is stopped and another process is given a chance to run. The kernel must stop the execution of the running process, copy out the values in hardware registers to its PCB, and update the hardware registers with the values from the PCB of the new process.
of the process since that is a convenient protected location.
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
kernel containing the information needed to manage a particular process. The PCB is "the manifestation of a process in an operating system".
Included information
Implementations differ, but in general a PCB will include, directly or indirectly:- The identifier of the process (a process identifierProcess identifierIn computing, the process identifier is a number used by most operating system kernels to uniquely identify a process...
, or PID) - RegisterProcessor registerIn computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
values for the process including, notably, the program counterProgram counterThe program counter , commonly called the instruction pointer in Intel x86 microprocessors, and sometimes called the instruction address register, or just part of the instruction sequencer in some computers, is a processor register that indicates where the computer is in its instruction sequence...
and stack pointer values for the process. - The address spaceAddress spaceIn computing, an address space defines a range of discrete addresses, each of which may correspond to a network host, peripheral device, disk sector, a memory cell or other logical or physical entity.- Overview :...
for the process - Priority (in which higher priority process gets first preference. eg., niceNice (Unix)nice is a program found on Unix and Unix-like operating systems such as Linux. nice directly maps to a kernel call of the same name. For a given process, it changes the priority in the kernel's scheduler. A niceness of −20 is the highest priority and 19 or 20 is the lowest priority...
value on Unix operating systems) - Process accounting information, such as when the process was last run, how much CPUCentral processing unitThe central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...
time it has accumulated, etc. - Pointer to the next PCB i.e. pointer to the PCB of the next process to run
- I/O Information (i.e. I/O devices allocated to this process, list of opened files, etc)
During context switch
Context switch
A context switch is the computing process of storing and restoring the state of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. The context switch is an essential feature of a multitasking operating system...
, the running process is stopped and another process is given a chance to run. The kernel must stop the execution of the running process, copy out the values in hardware registers to its PCB, and update the hardware registers with the values from the PCB of the new process.
Location of the PCB
Since PCB contains the critical information for the process, it must be kept in an area of memory protected from normal user access. In some operating systems the PCB is placed in the beginning of the kernel stackCall stack
In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack"...
of the process since that is a convenient protected location.