The Blocking of Processes
The above scenario is simple and fair if all Ready
processes are always truly ready to execute.
However, the existence of processes which continually execute to the end of
their time quanta, often termed compute-bound processes, is rare.
More generally, a process will request some input or output (I/O) from a
comparatively slow source (such as a disk drive, tape, keyboard, mouse, or
clock). Even if the "reply" to the request is available immediately, a
synchronous check of this will often exceed the remainder of the process's
time quantum. In general the process will have to wait for the request to be
satisfied.
The process should no longer be Running,
but it is not Ready either: at
least not until its I/O request can be satisfied.
We now introduce a new state for the operating system to support, Blocked,
to describe processes waiting for I/O requests to be satisfied.
A process requesting I/O will, of course, request the operating system to
undertake the I/O, but the operating system supports this as three
activities:
- requesting I/O to or from the device,
- moving the process from Running to Blocked,
- preparing to accept an interrupt when I/O completes.
(Very simply) when the I/O completion interrupt occurs, the requesting
process is moved from Blocked to Ready.
A degenerate case of blocking occurs when a process simply wishes to sleep
for a given period. We consider such a request as "blocking until a timer
interrupt", and have the operating system handle it the same way.
CITS2002 Systems Programming, Lecture 8, p8, 14th August 2024.
|