8.11 sleep (2066)

This procedure is called (from nearly 30 different places in the code) when a kernel process chooses to suspend itself. There are two parameters:

If this priority is negative the process cannot be aroused from its sleep by the arrival of a “signal”. “signals” are discussed in Chapter Thirteen.

2070:

The current processor status is saved to preserve the incoming processor priority and previous mode information;

2072:

If the priority is non-negative, a test is made for “waiting signals”;

2075:

A small critical section begins here, wherein the process status is changed and the parameters are stored in generally accessible locations (viz. within the array “proc”).

This code is critical because the same information fields may be interrogated and changed by “wakeup” (2113) which is frequently called by interrupt handlers;

2080:

When “runin” is non-zero, the scheduler (process #0) is waiting to swap another process into main memory;

2084:

The call on “swtch” represents a delay of unknown extent during which a relevant external event may have occurred. Hence the second test on “issig” (2085) is not irrelevant;

2087:

For negative priority “sleeps”, where the process typically waits for freeing of system table space, the occurrence of a “signal” is not allowed to deflect the course of the activity.