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".<ref>{{cite web |title=control block |url=https://www.pcmag.com/encyclopedia/term/control-block |website=PC Magazine Encyclopedia |publisher=PC Magazine |access-date=November 27, 2025}}</ref>
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.<ref name=SPQA>{{cite book |title=IBM System/3S0 Operating System MVT Guide |date=March 1972 |publisher=IBM Corporation |pages=185–189 |url=http://www.bitsavers.org/pdf/ibm/360/os/R21.0_Mar72/GC28-6720-4_MVT_Guide_Release_21_Mar72.pdf |access-date=November 28, 2025}}</ref>
==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'' (PSA),<ref>{{cite web |title=What's in an address space? |url=https://www.ibm.com/docs/en/zos-basic-skills?topic=storage-whats-in-address-space |website=z/OS concepts |publisher=IBM |access-date=November 28, 2025}}</ref> which is the first 8 KB at real address 0; that address is fixed by the z/Architecture Principles of Operation.<ref>{{cite book |url=https://www.ibm.com/docs/en/module_1678991624569/pdf/SA22-7832-14.pdf |title=z/Architecture Principles of Operation |page=3{{hyp}}21-3{{hyp}}23 |publisher=IBM |id=SA22-7832-14 |date=April 2025 |edition=Fifteenth}}</ref> Some are statically allocated by the operating system, such as the OS/360 through z/OS ''Communication Vector Table'' (CVT).<ref>{{cite book |series=Systems Reference Library |title=IBM System/360 Operating System: System Control Blocks |date=April 1973 |publisher=IBM |pages=21–31 |url=http://www.bitsavers.org/pdf/ibm/360/os/R21.7_Apr73/GC28-6628-9_OS_System_Ctl_Blks_R21.7_Apr73.pdf |access-date=November 28, 2025}}</ref> Others are dynamically created or initialized and removed by the operating system or application.<ref name=SPQA /> 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.<ref>{{cite web |title=open(3) - Linux man page |url=https://linux.die.net/man/3/open |website=die.net |access-date=November 28, 2025}}</ref><ref>{{cite web |title=close(3) - Linux man page |url=https://linux.die.net/man/3/close |website=die.net |access-date=November 28, 2025}}</ref>
==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:<ref>{{cite book |title=IBM Personal Computer Programming Family DOS Technical Reference |date=February 1985 |publisher=IBM Corporation |page=7-13–7-15 |url=https://bitsavers.org/pdf/ibm/pc/dos/6138536_DOS_3.10_Technical_Reference_Preliminary_Feb85.pdf |access-date=November 28, 2025}} Generated by ChatGPT "give me the c struct for a DOS FCB"</ref> <syntaxhighlight lang=C> /* Standard DOS FCB (24 bytes) */ typedef struct { uint8_t drive; // Drive number: 0 = default, 1 = A:, 2 = B:, etc. char filename[8]; // Filename (ASCII, padded with spaces) char ext[3]; // Extension (ASCII, padded with spaces) uint16_t current_block; // Current block number uint16_t record_size; // Logical record size (default 128 bytes) uint32_t file_size; // File size in bytes (set by DOS on open) uint16_t date; // Last write date uint16_t time; // Last write time uint8_t reserved[8]; // DOS internal use uint8_t current_record; // Current record within block uint32_t random_record; // Random record number for random I/O } FCB; </syntaxhighlight>
Here is the definition of a Multics ''Page Table Word'' in PL/I.<ref>{{cite web |title=io_ptw.incl.pl1 |url=https://web.mit.edu/multics-history/source/Multics/ldd/include/io_ptw.incl.pl1 |website=web.mit.edu/multics-history |access-date=November 28, 2025}}</ref> <syntaxhighlight lang=text> /* 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 */ </syntaxhighlight>
==References== {{Reflist}}
Category:Data structures