Jump to content

Control block

From Wikipedia, the free encyclopedia

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]

Storage

[edit]

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]

Mapping

[edit]

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

[edit]

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

 /* 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;

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 */

References

[edit]
  1. ^ "control block". PC Magazine Encyclopedia. PC Magazine. Retrieved November 27, 2025.
  2. ^ a b IBM System/3S0 Operating System MVT Guide (PDF). IBM Corporation. March 1972. pp. 185–189. Retrieved November 28, 2025.
  3. ^ "What's in an address space?". z/OS concepts. IBM. Retrieved November 28, 2025.
  4. ^ Systems Reference Library IBM System/3S0 Operating System: System Control Blocks (PDF). IBM Corporation. April 1973. pp. 21–31. Retrieved November 28, 2025.
  5. ^ "open(3) - Linux man page". die.net. Retrieved November 28, 2025.
  6. ^ "close(3) - Linux man page". die.net. Retrieved November 28, 2025.
  7. ^ IBM Personal Computer Programming Family DOS Technical Reference (PDF). IBM Corporation. February 1985. p. 7-13–7-15. Retrieved November 28, 2025. Generated by ChatGPT "give me the c struct for a DOS FCB"
  8. ^ "io_ptw.incl.pl1". web.mit.edu/multics-history. Retrieved November 28, 2025.