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.

Single segment 710 13K0process Aprocess B10K0 204264Kphysical main storekernel019KFigure 3.6 Single-segment methodThe hardware requires two pieces of information about the segment for the currentprocess: where it starts in main store (so that it can translate addresses) and how long thesegment is (so that it can check each access and forbid those that exceed the segment).These quantities are sometimes called the base and the bounds of the segment. Instead ofbuilding two tables, an address-translation table and a virtual-store descriptor table, thetwo functions are combined in the address-translation table, declared in line 6 below.1 const2 BitsPerPhysicalAddress = 24; { for example }3 type4 PhysicalAddress = integer; { BitsPerPhysicalAddress bits }5 var6 AddressTranslationTable =7 record8 Start : PhysicalAddress;9 Size : integer; { length of virtual space }10 end;A physical address might not fit in one integer because the machine may have more physicalstore than can be addressed at one time, and integers may have only enough bits toaddress the largest virtual store. This detail can be resolved by using extra words forphysical addresses. <strong>An</strong>other common approach is to truncate a p -bit physical address byretaining only the upper v bits, where v is the length of the largest virtual address. Thelower p −v bits are then assumed to be zero. This approach only allows physicaladdresses to be represented correctly if the lowest p −v bits are in fact zero.This method requires segments to be aligned on (p −v )-bit boundaries. For example,if virtual addresses are 18 bits long, but physical addresses are 24 bits, segmentsmust start at physical addresses that end with six zeros, that is, addresses divisible by 64.As we saw with partitions, alignment wastes the physical store between the end of onesegment and the beginning of the next because the latter must be aligned. In any case,the operating system designer has no choice in this matter; the design of the address-

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

Saved successfully!

Ooh no, something went wrong!