Overview

In this reading we’ll look in more detail at the process of translating virtual addresses to physical addresses. As part of this discussion, we’ll explore the performance impact of address translation and look at two ways to optimize this process. Finally, we’ll get a quick look at how the Linux kernel handles virtual memory, including the important data structures that it uses for address translation.

Required Reading

Sections 9.6 (excluding 9.6.4) and 9.7.2 (pp. 813-821, 828-832) from the course textbook.

Learning Objectives

BASIC Learning Objectives

Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.

  1. List the five steps performed by hardware when translating a virtual address to a physical address.
  2. List the seven steps taken when a page fault occurs.
  3. Describe the role of the translation lookaside buffer (TLB) in translating virtual addresses.
  4. Explain the motivation for using multi-level page tables as opposed to a single level page table.
  5. List the common Linux virtual memory areas (a.k.a. segments).
  6. Describe the role of each of the following structs in the Linux kernel: task_struct, mm_struct, and vm_area_struct.
  7. Describe the role of each field in Linux’s vm_area_struct struct.
  8. Summarize the three steps taken by the Linux kernel to handle a page fault.

ADVANCED Learning Objectives

The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.

  1. Given a TLB and a virtual address, determine if there will be a TLB hit or miss.
  2. Given a virtual address and a mutli-level page table organization, determine the size and address range of a last-level table.
  3. Given a set of vm_task_struct data structures for a process and a virtual address, determine if the page fault handler will result in either a segmentation fault or a protection exception.

Pre-class Exercises

These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.

  1. How does address translation differ when there is a TLB versus when there is not a TLB.

  2. How does our interpretation of a virtual page number differ between a single-level page table and a multi-level page table?

  3. What are the common Linux virtual memory areas for a process?

  4. For each of the following Linux VM structs, list whether there is one or more of each struct for a single process. For each answer, explain why.

  5. How does the Linux page fault handler determine whether there is a segmentation fault?