lock that is lower in the locking hierarchy. For example if a processor holds the free
storage lock, the processor cannot perform input/output. On the other hand, if a
processor holds the I/O lock, the processor can obtain free storage.
Figure 31 shows the hierarchy of locks under VM/SP where the global system lock
is the highest lock. The real storage management lock and the I/O lock are on the
same level. There are no situations which require simultaneous ownership of the I/O lock and the real storage management lock. If such a need arises, the system
will define a hierarchy between these locks.
Global SystQm Lock
Real Storage Management Lock I I/O Lock
Note:
V
Run List Lock I V
Timer Request Queue Lock I V
Dispatcher Stack lock RDEVBLOK Lock I V Private locks
Free Storage lock
Spin Locks
The VMBLOK is a defer lock and is not shown in this h;erarchy Figure 31. Hierarchy of VM/SP Locks
Types of Locks
Locking Structure
There are two basic types of locks:
Defer locks
Spin locks
If a function requests a defer lock and it is not available, control is returned to the
caller with a condition code that indicates that the lock is not available. However,
if a function -requests a spin lock and it is not available, the lock manager loops
until the lock becomes available.
To provide system integrity, VM/SP attached processor and multiprocessor sup:­ port is designed around one global lock, a VMBLOK local lock, and several system
local locks for specifically identified queues or modules.
Global System Lock: Much of CP runs under the global system lock, which is a
defer lock. For example, all command processing requires the global system lock.
Also, all code executed via an IOBLOK, TRQBLOK, or CPEXBLOK is protected
CP in Attached Processor and Multiprocessor Modes 215
by the global system lock. Certain basic system functions, however, are able to
execute without the global system lock on the mainline, non-error paths. These
functions include virtual page fault processing, the simulation of virtual 1/0 requests and some other privileged operations, and the processing of a real 1/0 interruption.
If a processor needs the global system lock and cannot obtain it, the processor
must defer the function until the global system lock is available. The function is
deferred by either stacking the VMBLOK appendage (called the deferred interrupt
block) or a CPEXBLOK for later processing. The processor that could not obtain
the global system lock then uses the unlocked dispatcher entry to dispatch a new
virtual machine.
In some situations, a function cannot be deferred even though the global system
lock is not available. In these cases, the dispatcher spins on the global system lock
until it becomes available. The dispatcher requires the system lock to unstack CPEXBLOKs, IOBLOKs, and TRQBLOKs. To ensure system integrity along the paths that do not require the global system
lock, other local locks have been defined. With the exception of the VMBLOK lock, these locks are all spin locks and are held for relatively short periods of time. VMBLOK Lock: The VMBLOK lock, which is a defer lock, is obtained by the dis­
patcher before dispatching a virtual machine in problem program state or before
performing any system service for that virtual machine. This lock prevents a virtual
machine from being serviced by CP while it is running in problem program state. ReDl Storage Management Lock (RM Lock): The real storage management lock
(called the RM lock) is a spin lock that serializes functions within the paging sub­
system. This lock controls all accesses to the free and flush lists, the page read and
write request queues, the deferred allocation queue, the active paging queue, CPEXBLOKs chained via CPEXMISC, and certain nonreentrant fields within
DMKPTR and DMKPAG. I/O Lock: The I/O lock is a spin lock that serializes access to I/O devices by seri­
alizing access to fields in the real I/O control blocks: RCHBLOK, RCUBLOK, and RDEVBLOK. Run List Lock: The run list lock is a spin lock that controls all additions to and
deletions from the run list.
Timer Request Queue Lock: The timer request queue lock is a spin lock that allows
the external first-level interruption handler to process a timer interruption without
the global system lock.
Dispatcher Stack Lock: The dispatcher stack lock is a spin lock that controls all
additions to or deletions from the IOBLOK/TRQBLOK queue or the CPEXBLOK queue.
RDEVBLOK Lock: The RDEVBLOK lock is a private spin lock that the paging
subsystem uses to serialize the IOBLOK queue.
Free Storage Lock: The free storage lock is a spin lock obtained by DMKFRE for
all FREE and FRET requests for free storage. All of the locks that CP uses are
described in further detail in VM / SP System Logic and Problem Determination
Guide.
216 VM/SP System Programmer's Guide
Previous Page Next Page