Control block


In computing, a control block is an area of memory or disk which contains a group of related data "used for identification and control purposes".
Computer operating systems, subsystems, and applications use control blocks to consolidate information regarding system and resource status. An operating system will have a control block which tracks the status of running programs. Examples of this are the process control block, thread control block, Task Control Block, or Service Request Blocks. Control blocks, which may be called called Unit Control Blocks, hold the status of all devices known to the system. Opened files are identified by control blocks which may be called File Control Blocks or Data Control Blocks. Operating systems or applications may manage memory using control blocks. For example IBM OS/360 MVT maintains subpools of storage for different purposes, which are tracked by control blocks.

Storage

Different control blocks have different storage characteristics. The location of some is determined by the computer architecture. An example of this is the z/OS Prefixed Save Area, which is the first 8 KB at real address 0; that address is fixed by the z/Architecture Principles of Operation. Some are statically allocated by the operating system, such as the OS/360 through z/OS Communication Vector Table. Others are dynamically created or initialized and removed by the operating system or application. Examples of this are Linux File Table entries, also called open file descriptions. These are created when a file is opened and removed when it is closed.

Mapping

A control block will have a definition or mapping one or more languages. These are equivalents of C structs that define the fields and values that they may contain. A program accessing a control block will usually have to supply a pointer containing the address of the block.

Example

Here is a sample C language mapping of a File Control Block from PC DOS:

/* Standard DOS FCB */
typedef struct FCB;

Here is the definition of a Multics Page Table Word in PL/I.

/* Begin include file io_ptw.incl.pl1 */
dcl io_ptwp ptr;
dcl 1 io_ptw aligned based,
2 pad1 bit unaligned,
2 address uns fixed bin unaligned,
2 pad2 bit unaligned,
2 write bit unaligned,
2 housekeeping bit unaligned,
2 valid bit unaligned,
2 pad3 bit unaligned;
/* End include file io_ptw.incl.pl1 */