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". [1]
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. [2]
Different control blocks have different storage characteristics. The location of some is determined by the computer architecture. An example of this is the IBM System Z Prefixed Save Area (PSA), which is the first 8 KB at real address 0. [3] Some are statically allocated by the operating system, such as the z/OS Communication Vector Table (CVT). [4] Others are dynamically created or initialized and removed by the operating system or application. [2] 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. [5] [6]
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.
Here is a sample C language mapping of a File Control Block from PC DOS: [7]
/* Standard DOS FCB (24 bytes) */typedefstruct{uint8_tdrive;// Drive number: 0 = default, 1 = A:, 2 = B:, etc.charfilename[8];// Filename (ASCII, padded with spaces)charext[3];// Extension (ASCII, padded with spaces)uint16_tcurrent_block;// Current block numberuint16_trecord_size;// Logical record size (default 128 bytes)uint32_tfile_size;// File size in bytes (set by DOS on open)uint16_tdate;// Last write dateuint16_ttime;// Last write timeuint8_treserved[8];// DOS internal useuint8_tcurrent_record;// Current record within blockuint32_trandom_record;// Random record number for random I/O}FCB;Here is the definition of a Multics Page Table Word in PL/I. [8]
/* Begin include file io_ptw.incl.pl1 */ dcl io_ptwp ptr; dcl 1 io_ptw aligned based (io_ptwp), 2 pad1 bit (2) unaligned, 2 address uns fixed bin (16) unaligned, 2 pad2 bit (13) unaligned, 2 write bit (1) unaligned, 2 housekeeping bit (1) unaligned, 2 valid bit (1) unaligned, 2 pad3 bit (2) unaligned; /* End include file io_ptw.incl.pl1 */