Memory partitions

A process may require more physical memory than there is currently available. We may wish to run several processes concurrently which together require more memory than there is RAM.

Swapping

The simplest solution to not having enough physical memory is to remove processes temporarily to disk; swapping processes between disk and RAM.

Swapping takes time, but there are probably other processes which could be run while processes are being swapped in and out (after all, swapping only makes sense in a multitasking system), so the processor is ideally still kept busy. On the other hand, if the process swapped out is interactive, swapping will drastically reduce the response time, since before it can respond (to a keypress or other user request), the process must be read back in from disk.

Swapping is fairly crude, swapping out whole processes at a time, more course-grained than overlays, for example. However, it is still used in some situations (some versions of UNIX), in association with other techniques.

Note that only the data and stack segments would be swapped; the text segment is from an executable file, so there is already a copy on disk; it can just be discarded when the process is swapped out, then read from the executable file when the process is swapped back in again.

Also note that a process need not be swapped back in to the same place in memory from which it was swapped out. Using base-limit registers, for example, the process could be brought back in somewhere else, possibly solving problems of process resizing.


last updated 18 May 1998