Example 8.2
An example, using 64 Mbytes of main memory, is shown in Figure 8.14.
Initially, main memory is empty, except for the OS (a). The first three processes are loaded
in, starting where the OS ends and occupying just enough space for each process (b, c, d).
This leaves a “hole” at the end of memory that is too small for a fourth process. At some
point, none of the processes in memory is ready. The OS swaps out process 2 (e), which
leaves sufficient room to load a new process, process 4 (f). Because process 4 is smaller
than process 2, another small hole is created. Later, a point is reached at which none of the
processes in main memory is ready, but process 2, in the Ready-Suspend state, is available.
Because there is insufficient room in memory for process 2, the OS swaps process 1 out (g)
and swaps process 2 back in (h).