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.

72 Space Management Chapter 3translation table is part of the hardware.Each process needs its own address-translation table. Since the table is only abouttwo words long, it is quite inexpensive to store it in the context block for the process.When the kernel switches context to this process, it copies the table to the hardware’sbase and bound registers. The hardware may have separate versions of these registers forprivileged and non-privileged state to make context switching more efficient. The algorithmused by the hardware on every access is simple:1 procedure Translate (VA : VirtualAddress) : PhysicalAddress;2 begin3 with AddressTranslationTable do4 if (VA < 0) or (VA ≥ Size) then5 trap("out of range");6 else7 Translate := Start + VA;8 end; { if }9 end; { with }10 end Translate;Figure 3.7 shows this algorithm. Figure 3.8 shows a concrete example that uses decimalnotation and assumes that a virtual address is three digits long and that physical storage is20,000 bytes.0>noyesout of rangecheckingno

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

Saved successfully!

Ooh no, something went wrong!