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.

100 Space Management Chapter 3The composite page tables to use for D 1 , D 2 , and E 1 are shown in Figure 3.18. Torun D 1 efficiently, its composite page table must be made available to the hardware. Theordinary page tables become a mirror that contains the ‘‘truth’’ about main-store allocation,and the hardware uses a table fabricated from these mirror tables. The hardwaretable is sometimes called a ‘‘shadow table’’ because it is just a fiction needed for efficientexecution.P 1 cannot be expected to prepare this composite table because it does not knowanything about the P 1 table; it believes that it is executing on the bare machine. Therefore,it is V’s job to prepare these composite tables. Composite tables must be updatedwhenever any of their component tables changes. For example, the composite for D 1depends on two tables. If P 1 should decide to swap out one of D 1 ’s pages, P 1 will modifyD 1 ’s page table. V must notice this change and update D 1 ’s composite page table. V canfollow either of two strategies to make sure the composites are accurate.Eager evaluation: V can map P i ’s virtual space so that when P i modifies what itthinks is a page table, it actually writes into read-only store. The resulting trapinforms V of the attempt. As V emulates the change, it also updates its compositetable.Lazy evaluation: V can map P i ’s virtual space so that P i may read and write whatit thinks is the page table. Whenever P i tries to switch context to one of itsprocesses, V must emulate the context switch, at which time it builds a compositetable for the process to which P i is switching.The eager-evaluation method must be used for the page tables that P i uses to control itsown (privileged-state) access to main store. It is the only method possible ifmodifications to address-translation tables can only be made by privileged instructions.The lazy approach can be much less work in the long run, especially if there are manylevels to the virtual-machine hierarchy. (Every virtualizing level builds its own compositetables.) Just as we saw in Chapter 1, enhanced hardware can make compositioneasier. The IBM 370 hardware can compose address-translation maps ‘‘on the fly,’’relieving the virtualizing kernel of this responsibility.D1 page frame pres.0 6 Y1 8 YD2 page frame pres.0n1 YE1012page frame42pres.YYY0 1 2 3 4 5 6 7 8 92 1 2 0E 1 E 1 D 0 D 1V physical storeFigure 3.18 Composite page tables

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

Saved successfully!

Ooh no, something went wrong!