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.

74 Space Management Chapter 30 13K0process Aprocess B10K0 1932 4264Kphysical main storekernel019KFigure 3.9 Result of shufflingin a single instruction, the Block Transfer instruction, which is used for shuffling.SCOPE, the operating system for the CDC 6600, reduces this cost by shuffling only whena process terminates. At that time, all free space is collected into one region.3.3 Placement and replacement policiesWhen a segment is to be swapped in or created, where should it be placed? When notenough room is free to hold the segment, which segment should be swapped out? Thesepolicy questions are not particularly easy to answer. We can, however, present someguiding principles.Several pieces of physical store may be currently available for a new segment.The best-fit method picks the free piece that will leave the minimal (but non-negative!)amount of waste if the new segment uses it. This method is generally very bad, since itleads to a proliferation of tiny and therefore useless free pieces and thereby forces largeshuffle operations. The first-fit method picks the first free piece that is large enough, nomatter how much waste there may be. This method is better, but if the algorithm alwaysstarts searching from the start of physical store, small pieces tend to cluster near the front.The average search therefore requires probing about half of all free chunks. Figure 3.10shows how first fit and best fit differ in choosing a region of free space. The recommendedallocation method is circular first fit, which is like first fit but starts the search atthe point that the previous search left off instead of always starting from the beginning ofphysical store. Now only a few probes are needed.Two cautions are in order. First, free space allocation within processes shows verydifferent behavior. Most applications require only a few different sizes of space. It is farmore efficient to allocate each different space size from a different pool. Adaptive

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

Saved successfully!

Ooh no, something went wrong!