homework6-main memory Version 0 |
|
👤 Author: by arashi 2017-12-21 15:07:31 |
In Pentium systems, the CPU generates logical addresses, which are given to the segmentation unit. The segmentation unit produces a linear address for each logical address. The linear address is then given to the paging unit, which in turn generates the physical address in main memory. Thus, the segmentation and paging units from the equivalent of the memory-management unit(MMU).
Pentium Segmentation
The Pentium architecture allows a segment to be as large as 4 GB, and the maximum number of segments per process is 16KB. The logical-address space of a process is divided into two partitions. The first partition consists of up to 8 KB segments that are private to that process. The second partition consists of up to 8 KB segments that are shared among all the processes. Information about the first partition is kept in the local descriptor table (LDT); information about the second partition is kept in the global descriptor table (GDT). Each entry in the LDT and GDT consists of an 8-byte segment descriptor with detailed information about a particular segment, including the base location and limit of that segment.
The logical address is a pair (selector, offset), where the selector is a 16-bit number in which s designates the segment number, g indicates whether the segment is in the GDT or LDT, and p deals with protection. The offset is a 32-bit number specifying the location of the byte (or word) within the segment in question.
The machine has six segment registers, allowing six segments to be addressed at any one time by a process. It also has six 8-byte microprogram registers to hold the corresponding descriptors from either the LDT or GDT. This cache lets the Pentium avoid having to read the descriptor from memory for every memory reference.
The linear address on the Pentium is 32 bits long and is formed as follows. The segment register points to the appropriate entry in the LDT or GDT. The base and limit information about the segment in question is used to generate a linear address. First, the limit is used to check for address validity. If the address is not valid, a memory fault is generated, resulting in a trap to the operating system. If it is valid, then the value of offset is added to the value of the base, resulting in a 32-bit linear address.
Pentium Paging
The Pentium architecture allows a page size of either 4 KB or 4 MB. For 4-KB pages, the Pentium uses a two-level paging scheme in which the division of the 32-bit linear address is as follows.
The ten high-order bits reference an entry in the outermost page table, which the Pentium terms the page directory. The page directory entry points to an inner page table that is indexed by the contents of the inner most ten bits in the linear address. Finally, the low-order-bits 0-11 refer to the off set in the 4-KB page pointed to in the page table.
One entry in the page directory is the Page Size flag, which-if set-indicates that the size of the page frame is 4 MB and not the standard 4 KB. If this flag is set, the page directory points directly to the 4-MB page frame, by passing the inner page table; and the 22 low-order bits in the linear address refer to the offset in the 4-MB page frame.
To improve the efficiency of physical memory use, Intel Pentium page tables can be swapped to disk. In this case, an invalid bit is used in the page directory entry to indicate whether the table to which the entry is pointing is in memory or on disk. If the table is on disk, the operating system can use the other 31 bits to specify the disk location of the table; the table then can be brought into memory on demand.