Download Input/Output Processing in IBM 370 Series: Central Processing Unit vs I/O Channels - Prof. and more Study notes Programming Languages in PDF only on Docsity! Input/Output Macros The subject of this lecture is the Input/Output system of the IBM 370 series. To quote the textbook “Input/output on the 370–series computers is significantly complex.” The reason for this complexity is a desire to achieve acceptable performance from the computing system, especially when it is running multiple jobs. Basically there are two forms of Input/Output processing available for use in the design of a computer. 1. The Central Processing Unit can manage all input/output operations. This has the trouble of idling the CPU during long I/O operations. 2. The I/O can be separately managed by independent hardware that is directed by the CPU and communicates with the CPU. IBM calls this an “I/O Channel”. This structure frees the CPU to do other tasks while the I/O is in process. Those who have taken computer architecture will remember that: 1. The I/O Channel is a special form of Direct Memory Access I/O device, which is a device that interacts directly with the computer’s main memory. 2. There are several classes of I/O channels: some for faster devices (such as disks), and some for slower devices (such as keyboard input). The Input/Output Process At the most fundamental level, all input and output is a cooperative process between the Central Processing Unit and the various I/O Channels of the computer. Input: 1. The CPU signals the I/O Channel with a request for input. 2. The I/O Channel reads its “channel program”, which is a sequence of “channel commands” that indicate what to do. 3. The I/O Channel deposits data in a buffer in the main memory of the computer. This buffer exists in system memory and is accessed by the OS. 4. The I/O Channel signals the CPU that the input has been completed. If needed, it can send an error code. Output: 1. The OS has received data from a user program and deposited the data in a buffer in the main system memory of the computer. 2. The OS signals the I/O Channel with a request for output. 3. The I/O Channel reads its channel program, which includes the address of the memory buffer containing the data. 4. The I/O Channel completes the output and signals the CPU on completion. Your User Program Requests Input As noted above, your user program cannot communicate directly with an I/O device. Thus it has to request I/O service by the O/S on its behalf. 1. The user program creates a work area of size sufficient to hold the input data. 2. The user program passes a request, including the address of this work area, to the operating system. This might be called a SVC (Supervisor Call). NOTE: This is not the same as a subroutine call. A subroutine operates under the control of the user program. These I/O routines are controlled by the O/S. 3. If the Operating System determines that the user request is appropriate and can be granted within the security guidelines, it will start an Input/Output Control Program. 4. The I/O Control Program generates sets aside a buffer in system space for the data that will be input. It then generates a sequence of channel commands, which are directions to the I/O Channel of what it to be done. It then sends a signal to the I/O Channel, which begins the appropriate processing. 5. The I/O Control Program suspends itself and the Operating System marks the user program as “blocked, waiting for I/O”. It then suspends the user program and grants the CPU to another user program that is ready to run. The Classis Process Diagram Here is the standard process state diagram associated with modern operating systems. When a process (think “user program”) executes an I/O trap instruction (remember that it cannot execute the I/O directly), the O/S suspends its operation & starts I/O on its behalf. The job is then marked as “blocked”, awaiting completion of the I/O. Another job is run. When the I/O is complete, the O/S marks the process as “ready to run”. It will be assigned to the CPU when it next becomes available. Levels of I/O Commands The goal of the I/O Macros is to isolate the programmer from the detailed control of the Input/Output devices. Much of the detailed code is tedious and difficult. The Channel Command Level can be seen as the lowest level. Commands at this level are all privileged and not executable by user programs. Start I/O Test I/O Halt I/O Test Channel The Physical I/O Level is the next lowest level. This level initiates the channel commands and handles I/O interrupts, all still low–level stuff. Commands include: EXCP Execute Channel Program WAIT Wait for completion of the channel program CCB Channel Control Block The Logical I/O Level is the one that most user programs access to define the layout and start both input (GET) and output (PUT).