Interrupts and system state
This discussion further illustrates the z/TPF system's emphasis on meeting the demands of the current program as quickly as possible. At this point, it is necessary to distinguish between a hardware interrupt and a software interrupt. Program, restart, I/O, machine check, and external interrupts are classified as hardware interrupts. An SVC interrupt is classified as a software interrupt.
When a hardware or software interrupt arrives while the z/TPF system is in problem state, as part of the hardware reaction to the interrupt, the system state changes to supervisor state, the current processing environment is saved (PSW swapping), and control is transferred to the designated z/TPF system interrupt handler. The z/TPF system interrupt handlers run with interrupts disabled to prevent the z/TPF system from falling into an infinite loop that could occur by processing subsequent interrupts. The disabling of interrupts does not degrade the z/TPF system because the interrupt handlers are deliberately designed as only short sequences of code.
For a software interrupt, the interrupt handler (that is, the macro decoder) identifies the action to be taken as a result of the interrupt, re-enables interrupts, and transfers control to a system program (a macro service routine) to perform the action. The system program, still in supervisor state, processes the action related to the interrupt, puts the system in problem state, and returns control to the program that was interrupted. When another software interrupt arrives, the process repeats itself.
For a hardware interrupt, the interrupt handler identifies the action to be taken as a result of the interrupt, queues the remaining processing for subsequent processing, re-enables interrupts, puts the z/TPF system into problem state, and returns control to the program that was interrupted. When another hardware interrupt occurs, the process repeats itself.
The various system programs that process in supervisor state mask interrupts depending on their types of processing so that when hardware interrupts do occur during their processing, the interrupts are stacked and subsequently processed once interrupts are unmasked.
Privileged instructions SET SYSTEM MASK, LOAD PSW, and LOAD PSW EXTENDED are used by the z/TPF system programs to change the system state.