13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Single segment 73Start 13426Size 726Virtual address Physical address 0 13426 232 13658 233 13659 725 14151 726 trap: out of range 999 trap: out of range 1436 trap: out of range 3.2 BenefitsFigure 3.8 Example of address translationThe single-segment approach is much more elegant than the partition approach.Processes benefit in two ways: All programs may assume that they start at location zero,and they never need to establish addressability. In fact, the binding to physical addressesis performed at access time, that is, on every access to virtual store. In addition, a programthat runs out of room can request more from the operating system. Such a requestmay block the process for a while (in medium-term scheduling) as the storage managerrearranges physical store, but as long as the process does not require a larger space thanphysical store permits, the request can be granted.The operating system also benefits from the single-segment approach. A processresiding in a wait list may be swapped to backing store, freeing a contiguous piece ofphysical store for some other process. When the previously swapped process is readyagain, it may be brought into main store anywhere that it fits. The storage manager neednot place it in exactly the same position as before, as long as its context block reflects itscurrent location.Likewise, in order to make room for new processes, the storage manager mayshuffle processes around within physical store. Shuffling collects all the free space intoone large piece. A process that would not be able to fit in any of the previous smallerpieces might fit there. Shuffling is sometimes called ‘‘compaction’’ because it squeezesall the free space out of the region in use. Figure 3.9 shows the results of shuffling theprocesses we showed in Figure 3.6. Now there are no tiny, useless holes between segments.The processes A and B need not know that shuffling has occurred; their virtualspace is untouched.Unfortunately, the single-segment approach has its drawbacks, too. Sharingbetween processes is not possible except for complete sharing, which is not very useful.Swapping and shuffling can be quite expensive. It has been estimated that as much as 30percent of the time spent by Tops-10, an operating system for the DEC PDP-10, is spent

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!