Example: The Intel Pentium

Rating - 4/5

The Intel Pentium

Both paging and segmentation have advantages and disadvantages. In fact, some architectures provide both. In this section, we discuss the Intel Pentium architecture, which supports both pure segmentation and segmentation with paging. We do not give a complete description of the memory-management structure of the Pentium in this text.

 Rather, we present the major ideas on which it is based. We conclude our discussion with an overview of Linux address translation on Pentium systems. 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 form the equivalent of the memory-management unit (ViMU). This scheme is shown in Figure 8.21

Pentium Segmentation

The Pentium architecture allows a segment to be as large as 4 GB, and the maximum number of segments per process is 16 KB. The logical-address space 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.

These Topics Are Also In Your Syllabus
1 Features of Real-Time Kernels link
2 Implementing Real-Time Operating Systems link
You May Find Something Very Interesting Here. link
3 What is VxWorks 5.x? link
4 Mutual Exclusion link
5 Event Ordering link

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 the offset is added to the value of the base, resulting in a 32-bit linear address. This is shown in Figure 8.22. In the following section, we discuss how the paging unit turns this linear address into a physical 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:

These Topics Are Also In Your Syllabus
1 File System Structure link
2 Operating System Services link
You May Find Something Very Interesting Here. link
3 User OS interface link
4 Os design and Implementation link
5 Virtual machines link

detail in Figure 8.23. The ten high-order bits reference an entry in the outermost page table, which the Pentium terms the page directory. (The CR3 register points to the page directory for the current process.) The page directory entry points to an inner page table that is indexed by the contents of the innermost ten bits in the linear address.

Finally, the low-order bits 0-11 refer to the offset 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, bypassing 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.

These Topics Are Also In Your Syllabus
1 Disk scheduling link
2 Disk Management link
You May Find Something Very Interesting Here. link
3 File System Structure link
4 Operating System Services link
5 User OS interface link

Linux on Pentium Systems

 As an illustration, consider the Linux operating system running on the Intel Pentium architecture. Because Linux is designed to run on a variety of processors—many of which may provide only limited support for segmentation— Linux does not rely on segmentation and uses it minimally- On the Pentium, Linux uses only six segments:

 1. A segment for kernel code

2. A segment for kernel data

3. A segment for user code

These Topics Are Also In Your Syllabus
1 Critical Section problems link
2 Semaphore In Operation System link
You May Find Something Very Interesting Here. link
3 Contiguous memory allocation link
4 Monitors link
5 Segmentation link

4. A segment for user data

5. A task-state segment (TSS)

6. A default LDT segment

The segments for user code and user data are shared by all processes running in user mode. This is possible because all processes use the same logical address space and all segment descriptors are stored in the global descriptor table (GDT). Furthermore, each process has its own task-state segment (TSS), and the descriptor for this segment is stored in the GDT. The TSS is used to store the hardware context of each process during context switches. The default LDT segment is normally shared by all processes and is usually not used. However, if a process requires its own LDT, it can create one and use that instead of the default LDT.

These Topics Are Also In Your Syllabus
1 Access Matrix link
2 What is Election Algorithms ? link
You May Find Something Very Interesting Here. link
3 Explain Reaching Agreement. link
4 What is Atomicity? link
5 Types Of Systems link

As noted, each segment selector includes a 2-bit field for protection. Thus, the Pentium allows four levels of protection. Of these four levels, Linux only recognizes two: user mode and kernel mode. Although the Pentium uses a two-level paging model, Linux is designed to run on a variety of hardware platforms, many of which are 64-bit platforms where two-level paging is not plausible. Therefore, Linux has adopted a threelevel paging strategy that works well for both 32-bit and 64-bit architectures. The linear address in Linux is broken into the following four parts:

Each task in Linux has its own set of page tables and —just as in Figure 8.23 — the CR3 register points to the global directory for the task currently executing. During a context switch, the value of the CR3 register is saved and restored in the TSS segments of the tasks involved in the context switch.

Rating - 4/5

Rating - 4/5