CPU loop (dispatching work)

The z/TPF system uses a system program called the CPU loop to select an Entry for execution by an I-stream engine. Sometimes the term system task dispatcher is used rather than CPU loop.

In a central processor complex (CPC) with multiple I-stream engines, the CPU loop (operating within an I-stream engine) continuously inspects its cross list to which another I-stream engine may have added work.

Although the phrase system task dispatcher is sometimes used in z/TPF information, the term CPU loop is pervasive. Task is a term that has the connotation of an application process found in the IBM® z/OS® operating system. A z/TPF Entry is structured differently from a z/OS task. Rather than being called the system task dispatcher, a better name would be system entry dispatcher or simply dispatcher. In the face of this dilemma, the term CPU loop is used in this information.

The order of processing priority is determined by the sequence in which the CPU loop interrogates queues that identify work items to be dispatched. The term list refers to the CPU loop queues. Unfortunately, this term is also used to refer to tables that are not queues. As a result of the long history of the z/TPF system, the vernacular phrase CPU loop list is also used in this information to refer to a queue used to dispatch work to an I-stream engine.

The following CPU loop lists are in order of processing priority:
  1. Cross list

    The cross list is used to dispatch entries between I-stream engines.

  2. Time dispatch list

    The time dispatch list is used to dispatch time-sensitive events.

  3. Ready list and OSA ready list

    The ready list is used to start processing a high-priority task, or to return control to an entry that was already created as the result of some completed system activity.

    The Open Systems Adapter (OSA) ready list is a shared list that is used to process high priority input messages that arrive on the network from an OSA-Express® connection.

  4. Input list and OSA Input list

    The input list is used to dispatch a new entry for processing an input message that has an I-stream affinity to this particular I-stream engine.

    The OSA input list is a shared list that is used to process input messages that arrive on the network from an OSA-Express connection.

  5. Deferred list

    The deferred list is used to delay the execution of an entry that has an I-stream affinity to this particular I-stream engine.

In addition to the main CPU loop lists, the following secondary lists are present on each of the I-stream engines:

  • Virtual file access count (VCT) list

    This list contains entries that were forced to give up control after exceeding a system resource threshold, one of which is the number of virtual file access (VFA) record accesses. The VCT list is checked once every pass through all items on the input list. When the VCT list is interrogated, every item that is found on it is moved to the ready list, if possible.

  • Suspend list
    This list contains Entries that where suspended after exceeding a system resource threshold. The suspend list is used for the LODIC macro when the availability of system resources is below the shutdown levels defined for a particular resource priority class, utilization priority class, or both, or for the TMSLC macro when the entry has run for a defined time limit. Items on the suspend list are processed as follows:
    • One item representing an entry that uses a resource priority class is processed after one pass through every item on the input list.
    • Items representing entries that use a utilization priority class are processed every 50 ms.
  • Low priority utility list

    This list contains ECBs that are set with the low priority ECB attribute and are ready to be dispatched.

    An ECB with the low priority attribute is dispatched from the low priority utility list when one of the following conditions occurs:
    • After a record find or file action that goes to DASD is completed
    • When the ECB is dispatched from the virtual file access count (VCT) list
    • After the ECB is suspended because of a time slice
    • After the ECB is suspended because of a LODIC macro call
    • After a tape request that causes the ECB to give up control

    The low priority utility list consists of a chain of ECBs and is serviced by using the deferred list. When an ECB is put on the low priority utility list, the ECB is put at the end of the chain and an entry to service the low priority utility list is put on the deferred list. When the entry to service the low priority utility list is removed from the deferred list, the first ECB is removed from the chain and dispatched. If there is no ECB on the low priority utility list, control is returned to the top of the CPU loop. If the deferred list cannot be processed because of too many active ECBs, the low priority utility list is serviced. In this case, if the low priority utility list is not empty, the first ECB is removed from the chain and dispatched.

Through linkage conventions, these queues point to all the input necessary for an application to initially process or continue processing an input message.

In principle, the CPU loop is a set of programs with pointers to unique processing work lists (CPU loop lists) depending on which I-stream engine the CPU loop is running. All the lists, except the cross list, are private to an I-stream engine. The cross list is used to move work between I-stream engines. The CPU loop lists are located by pointers anchored in the prefix area (for each I-stream engine).

An Entry and an item on a CPU loop list, although closely related, are not the same thing. An item on a CPU loop list points to a system service routine that must be invoked before starting or returning to an Entry. This distinction is necessary to describe some important details required to understand the z/TPF structure. When you get to the detailed system information, an entry on a list may not be distinguished from a z/TPF application process called an Entry.

Control program components associated with message processing place items on the CPU loop lists:
  • Most communications control input routines place items (corresponding to input messages) on the main I-stream engine input list. By design, these routines run only on the main I-stream engine. Messages from an OSA-Express connection are placed on the OSA input message list and can be processed by any I-stream engine.

    In a uniprocessor environment, multi-processor interconnect facility (MPIF) input routines also place items on the main I-stream engine input list. In a multiprocessor environment, however, the MPIF input routines run only on I-stream engine 2 (known as the MPIF I-stream engine), and MPIF input items are placed on the input list for this I-stream engine. MPIF I/O is considered to be high priority and, therefore, is handled by an I-stream engine that is different from the one that handles all the other non-DASD-related I/O for the z/TPF system.

  • System service routines, invoked as a result of interrupts caused by I/O completion, place items on the ready list.
  • COMM SOURCE, running in the main I-stream engine, dispatches an Entry to an application I-stream engine by placing the Entry on the cross list of the (destination) application I-stream engine. When the application I-stream engine finds the Entry on its cross list, the Entry is moved to its ready list.

Whenever the ready or input lists are not empty, the CPU loop merely selects the work identified by the first item on one of these lists, giving priority to the ready list. (The deferred, VCT, and suspend lists are not needed to trace a normal message through the system and are not emphasized in this overview.)

In addition to processing the CPU loop lists, the CPU loop performs the following tasks:
  • Checks for responses from certain hardware devices; such as, coupling facilities (CFs) and cryptographic accelerators.
  • Polls communications devices; such as, communication control program (CCP), OSA, and Systems Network Architecture (SNA) devices.
  • Processes the time available supervisor (TAS), which is a procedure for accepting low-priority work items. The TAS is managed with the TASBC and TASTC macros. See z/TPF System Services for more information about the TASBC and TASTC macros.