13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

84 Space Management Chapter 3unusable because it is needed for these tables we will call overhead space.A process might not be using all the space in a segment; it may have asked for asegment that is bigger than is really needed. This type of unused area is calledinternal waste.Segmentation tends to have very little internal waste because processes generally requestexactly the amount of space they need. <strong>An</strong>y internal waste that exists is not the storagemanager’s fault; it is due to restrictions imposed by the hardware that require segmentlengths to be divisible by some power of 2.External waste can be reduced by shuffling, but that solution is expensive. If segmentsare aligned to chunk boundaries, at the end of each segment there will be a smallamount of unavoidable external waste ranging from 0 bytes to 1 byte less than the chunksize. On the average, this external waste will be one-half a chunk size for each segmentin main store. The amount of overhead space depends on how many segments areallowed, a number that itself depends on the number of bits in a virtual address allocatedto the segment number. The more segments that are allowed, the more space is devotedto overhead, and the smaller the segments may be. The amount of overhead space is notunder the control of the operating system designer except for the decision to swap unusedsegment tables.5.7 Initial loading and executionA program needs separate segments to store different data items or subroutines.Cooperation between the storage manager and the loader establishes the initial assignmentof segments in virtual store, and cooperation between the storage manager and therunning process can change that assignment dynamically. The load image must specifyin which segment each instruction or data section belongs. Instruction segments typicallyget Execute permission only; data sections can be specified to be either Read/Write oronly Read. When the loader initializes virtual space, it can bring all the segments intomain store or can leave them on backing store. In the latter case, the program will slowlyacquire the segments it needs by faulting.The Split service call might indicate the disposition of each segment in the parent’svirtual space:Unique. The segment becomes the sole property of either the parent or the child.The segment table for the other process indicates that the segment is absent.Shared. The segment is listed in the segment tables of both parent and child.Copied. The child gets a private version, initialized as a copy of the segment stillowned by the parent. The storage manager copies the data and builds a new segment,allocating backing store at the same time. Alternatively, the storage managercan employ a form of lazy evaluation: Let child and parent share the segment, butdeny both of them Write permission. Perhaps neither will ever try to modify thedata. As soon as either one does, the hardware will trap to the storage manager,which can make a new copy for the child and give both processes Write permissionover their (now private) copies. This technique is called copy on write.

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

Saved successfully!

Ooh no, something went wrong!