Unit Control Block Explained

In IBM mainframe operating systems OS/360 and its successors, a Unit Control Block (UCB) is a memory structure, or a control block, that describes any single input/output peripheral device (unit), or an exposure (alias), to the operating system. Certain data within the UCB also instructs the Input/Output Supervisor (IOS) to use certain closed subroutines in addition to normal IOS processing for additional physical device control.

Some other operating systems have similar structures.

Overview

During initial program load (IPL) of current MVS systems, the Nucleus Initialization Program (NIP) reads necessary information from the I/O Definition File (IODF) and uses it to build the UCBs. The UCBs are stored in system-owned memory, in the Extended System Queue Area (ESQA). After IPL completes, UCBs are owned by Input/Output Support. Some of the data stored in the UCB are: device type (e.g. disk, tape, printer, terminal), address of the device (such as 1002), subchannel identifier and device number, channel path ID (CHPID) which defines the path to the device, for some devices the volume serial number (VOLSER), and a large amount of other information, including OS Job Management data.

While the contents of the UCB has changed as MVS evolved, the concept has not. It is a representation to the operating system of an external device. Inside every UCB are the UCBIOQ pointer to the current[1] IOS Queue Element[2] (IOQ), UCBIOQF and UCBIOQL pointers[3] to a queue of IOQs (IOQs) and a subchannel number for the subchannel-identification word used in the start subchannel (SSCH) instruction to start a channel program (chain of channel command words (CCWs)).[4]

The UCB evolved to be an anchor to hold information and states about the device. The UCB currently has five areas used for an external interface: Device Class Extension, UCB Common Extension, UCB Prefix Stub, UCB Common Segment and the UCB Device Dependent Segment. Other areas are internal use only. This information can be read and used to determine information about the device.

In the earliest implementations of OS/360, the UCBs (foundations and extensions) were assembled during SYSGEN, and were located within the first 64 KB of the system area, as the I/O device lookup table consisted of 16-bit addresses. Subsequent enhancements allowed the extensions to be above the 64-kilobyte (65,536 bytes) line, thereby saving space for additional UCB foundations below the 64-kilobyte line and also thereby preserving the architecture of the UCB lookup table (converting a CUu to a UCB foundation address). Eventually an installation could choose to place UCBs above the 16 MiB line, although in a process called shadowing the UCB the OS creates a temporary local copy of the UCB when allocating a file without the XTIOT option.

Handling parallel I/O operations

UCBs were introduced in the 1960s with OS/360. Then a device addressed by UCB was typically a moving head hard disk drive or a tape drive, with no internal cache. Without it, the device was usually grossly outperformed by the mainframe's channel processor. Hence, there was no reason to execute multiple input/output operations to it at the same time, as these would be impossible for a device to physically handle. In 1968, IBM introduced the 2305-1 and 2305-2 fixed-head disks, which had rotational position sensing (RPS) and eight exposures (alias addresses) per disk; the OS/360 support provided a UCB per exposure in order to permit multiple concurrent channel programs.[5] Similarly, later systems derived from OS/360 required an additional UCB for each allocated virtual volume in a IBM 3850 Mass Storage System (MSS),[6] and for each exposure on a 3880-11 and its successors.[7] [8]

Parallel Access Volumes (PAVs)

Since only one set of channel commands or I/O could be run at one time. This was fine in the 1960s when CPUs were slow and I/O could only be processed as fast as CPUs could process it. As systems matured and CPU speed greatly surpassed I/O input capacity, access to the device that was serialized at the UCB level became a serious bottleneck.

Parallel Access Volume (PAV) allow UCBs to clone themselves to allow multiple I/O to run simultaneously. With appropriate support by the DASD hardware, PAV provides support for more than one I/O to a single device at a time. To maintain backward compatibility, operations are still serialized below the UCB level. But PAV allows the definition of additional UCBs to the same logical device, each using an additional alias address. For example, a DASD device at base address 1000, could have alias addresses of 1001, 1002 and 1003. Each of these alias addresses would have their own UCB. Since there are now four UCBs to a single device, four concurrent I/Os are possible. Writes to the same extent, an area of the disk assigned to one contiguous area of a file, are still serialized, but other reads and writes occur simultaneously. The first version of PAV the disk controller assigns a PAV to a UCB. In the second version of PAV processing, Workload Manager (WLM) reassigns a PAV to new UCBs from time to time. In the third version of PAV processing, with the IBM DS8000 series, each I/O uses any available PAV with the UCB it needs.

The net effect of PAVs is to decrease the IOSQ time component of disk response time, often to zero. the only restrictions to PAV are the number of alias addresses, 255 per base address, and overall number of devices per logical control unit, 256 counting base plus aliases.

HyperPAVs

WLM's actions in moving aliases from one disk device to another take a few seconds for the effects to be seen. For many situations this is not fast enough. HyperPAVs are significantly more responsive because they acquire a UCB from a pool for the duration of a single I/O operation, before returning it to the pool. Thus, a smaller number of UCBs are required to service the same workload, compared to Dynamic PAVs. There is no delay waiting for WLM to react.[9]

In other operating systems

Digital's VMS operating system uses an identically named structure, the UCB, for similar purposes. A UCB is created for each I/O device. The data in the UCB includes the device's unit number (a part of the device name) and a listhead to which pending I/O requests may be queued. The UCB may have a device-driver defined extension in which the driver can keep driver-defined data that is instantiated for each device.[10]

Notes and References

  1. Book: z/OS 2.5 MVS Data Areas MVS Data Areas Volume 4 (RRP - XTL) . GA32-0938-500 . September 30, 2021. UCB Mapping . https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5ga320938/$file/iead400_v2r5.pdf#page=1039 . 994 . IBM . May 9, 2022.
  2. Book: z/OS 2.5 MVS Data Areas Volume 2 (IAX - ISG) . GA32-0936-50 . September 30, 2021. IOQ Information . https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5ga320936/$file/iead200_v2r5.pdf#page=1097 . 1033–1039 . IBM . May 8, 2022.
  3. Book: z/OS 2.5 MVS Data Areas Volume 2 (IAX - ISG) . GA32-0936-50 . September 30, 2021. IOSDUPFX mapping . https://www.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R5ga320936/$file/iead200_v2r5.pdf#page=1244 . 1181 . IBM . May 9, 2022.
  4. Book: z/Architecture Principles of Operation . Fourteenth . SA22-7832-13 . 1415 . IBM . May 2022 . January 24, 2023 .
  5. Book: OS System Generation – Release 21.8 . GC28-6554-13 . August 1974 . Fourteenth . IODEVICE . http://bitsavers.org/pdf/ibm/360/os/R21.8_Aug74/GC28-6554-13_OS_System_Generation_Release_21.8_Aug74.pdf#page=359 . 339 . IBM . January 24, 2023 .
  6. Book: Introduction to the IBM 3850 Mass Storage System (MSS) . GA32-0028-2 . July 1975 . Third . Virtual Drive Concept . http://bitsavers.org/pdf/ibm/3850/GA32-0028-7_Introduction_to_the_IBM_3850_Mass_Storage_System_Jul75.pdf#page=23 . 22 . IBM . January 24, 2023 .
  7. Web site: IBM 3880 Storage Control Model 21 . 184-119 . September 18, 1984 . IBM . January 24, 2023 .
  8. Book: IBM 3880 Storage Control Model 21 - Installation and Administration Guide . GA32-0084-0 . October 1984 . First . IBM . 3 . January 24, 2023 .
  9. Book: Paul . Rogers . Alvaro . Salla . Livio . Sousa . September 2008 . ABCs of z/OS System Programming . 10 . SG24-6990-03 . Fourth . 7.22 HyperPAV feature for DS8000 series . https://s3p.manualzz.com/store/data/029464005.pdf?key=16282d34a07d49405e04fd1acc6a24b6&r=1&fn=29464005.pdf&t=1651800442156&p=86400#page=512 . 494 . Redbooks . IBM . May 5, 2022 .
  10. Book: Goldenberg . Ruth . Saravanan . Sara . 1994 . OpenVMS AXP Internals and Data Structures . Digital Press . 753 . 978-1555581206 . The executive creates a unit control block (UCB) for each I/O device attached to the system. .