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.

Paging 9328 procedure Translate (VA : VirtualAddress) : PhysicalAddress;29 var30 Segment : 0 .. SegmentLimit − 1;31 Page : 0 .. PageLimit − 1;32 Offset : 0 .. PageSize − 1;33 DescriptorPageTable : PhysicalAddress;34 PageInSegmentTable : PhysicalAddress;35 PageTable : PhysicalAddress;36 PageFrame : PhysicalAddress;37 begin38 Segment := VA [0..17];39 Page := VA [18..25];40 Offset := VA [26..35];41 DescriptorPageTable := DescriptorBaseRegister.PageTablePointer42 * PageSize;43 PageInSegmentTable :=44 (DescriptorPageTable + Segment [0..7])ˆ.Location * PageSize;45 PageTable :=46 (PageInSegmentTable + Segment [8..17]) ˆ.PageTablePointer47 * PageSize;48 PageFrame := (PageTable + Page)ˆ.Location * PageSize;49 Translate := PageFrame + Offset;50 end Translate;For clarity, all the security checks have been omitted. Even so, the algorithm is quitecomplicated. Figure 3.14 shows the essential steps for translating the virtual address(S,P,F). The circled numbers represent values that are computed at corresponding linesin the program. This figure omits the fact that the segment table is itself paged. Lines41−44 of the program perform the translation shown in dotted lines in the figure. Thispart of the algorithm is shown in more detail in Figure 3.15. The machine uses a translationlook-aside buffer to avoid address translation while finding the descriptor page table,the page of the segment table, and the segment page table.In both figures, the letters a through f refer to the checks that might fail duringtranslation:abcdefghThe segment number is beyond the limit for this process.The process does not have the necessary access permission over any part of its virtualstore.The segment table is missing.The appropriate page of the segment table is missing.The page number is beyond the limit for this segment.The process does not have the necessary access permission over this segment.The page table for this segment is missing.The particular page accessed is missing.Traps c, d, g, and h are failures due to swapped-out information that must be broughtinto main store before the access can complete. Traps a, b, e, and f signal errors in theprocess.Shared segments are allowed in Multics. The storage manager maintains an‘‘active-segment table’’ to record which segments are currently in use by any process.Each entry in this table has the following information.the external name of the segment

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

Saved successfully!

Ooh no, something went wrong!