Address Translation - PowerPoint PPT Presentation

About This Presentation
Title:

Address Translation

Description:

Address Translation Inverted Page Table + The number of page table entry is proportional to the size of physical RAM - Collision handling - Hard to do shared memory ... – PowerPoint PPT presentation

Number of Views:8
Avg rating:3.0/5.0
Slides: 35
Provided by: csFsuEdu
Learn more at: http://www.cs.fsu.edu
Category:

less

Transcript and Presenter's Notes

Title: Address Translation


1
Address Translation
2
Recall from Last Time
  • Translation tables are implemented in HW,
    controlled by SW

Virtual addresses
Physical addresses
3
This Lecture
  • Different translation schemes
  • Base-and-bound translation
  • Segmentation
  • Paging
  • Multi-level translation
  • Paged page tables
  • Hashed page tables
  • Inverted page tables

4
Assumptions
  • 32-bit machines
  • 1-GB RAM max

5
Base-and-Bound Translation
  • Each process is loaded into a contiguous region
    of physical memory
  • Processes are protected from one another

Virtual address
6
Base-and-Bound Translation
  • Each process thinks that it is running on its
    own dedicated machine, with memory addresses from
    0 to bound

Virtual addresses
Physical addresses
0
code data stack
bound
7
Base-and-Bound Translation
  • An OS can move a process around
  • By copying bits
  • Changing the base and bound registers

8
Pros and Cons of Base-and-Bound Translation
  • Simplicity
  • Speed
  • - External fragmentation memory is wasted
    because the available memory is not contiguous
    for allocation
  • - Difficult to share programs
  • Each instance of a program needs to have a copy
    of the code segment

9
Pros and Cons of Base-and-Bound Translation
  • - Memory allocation is complex
  • Need to find contiguous chunks of free memory
  • Reorganization involves copying
  • - Does not work well when address spaces grow and
    shrink dynamically

10
Segmentation
  • Segment a region of logically contiguous memory
  • Segmentation-based transition use a table of
    base-and-bound pairs

11
Segmentation Illustrated
Virtual addresses
Physical addresses
12
Segmentation Diagram
Virt seg
Offset
13
Segmentation Diagram
2
0x200
14
Segmentation Translation
  • virtual_address virtual_segment_numberoffset
  • physical_base_address segment_tablevirtual_segm
    ent_number
  • physical_address physical_base_addressoffset

15
Pros and Cons of Segmentation
  • Easier to grow and shrink individual segments
  • Finer control of segment accesses
  • e.g., read-only for shared code segment
  • More efficient use of physical space
  • Multiple processes can share the same code
    segment
  • - Memory allocation is still complex
  • Requires contiguous allocation

16
Paging
  • Paging-based translation memory allocation via
    fixed-size chunks of memory, or pages
  • The memory manager uses a bitmap to track the
    allocation status of memory pages
  • Translation granularity is a page

17
Paging Illustrated
Virtual addresses
Physical addresses
0x0
0x0
0x1000
0x1000
0x2000
0x2000
0x3000
0x3000
0x3fff
0x4000
18
Paging Diagram
19
Paging Example
20
Paging Translation
  • virtual_address virtual_page_numberoffset
  • physical_page_number page_tablevirtual_page_num
    ber
  • physical_address physical_page_numberoffset

21
Pros and Cons of Paging
  • Easier memory allocation
  • Allows code sharing
  • - Internal fragmentation allocated pages are
    not fully used
  • - The page table size can potentially be very
    large
  • 32-bit architecture with 1-KB pages can require 4
    million table entries

22
Multi-Level Translation
  • Segmented-paging translation breaks the page
    table into segments
  • Paged page tables Two-level tree of page tables

23
Segmented Paging
24
Segmented Paging
25
Segmented Paging Translation
  • virtual_address segment_numberpage_numberoffse
    t
  • page_table segment_tablesegment_number
  • physical_page_number
  • page_tablepage_number
  • physical_address physical_page_numberoffset

26
Pros and Cons of Segmented Paging
  • Code sharing
  • Reduced memory requirements for page tables
  • - Higher overhead and complexity
  • - Page tables still need to be contiguous
  • - Each memory reference now takes two lookups

27
Paged Page Tables
Page table num
Offset
Virt page num
28
Paged Page Table Translation
  • virtual_address outer_page_numinner_page_numof
    fset
  • page_table outer_page_tableouter_page_num
  • physical_page_num inner_page_tableinner_page_nu
    m
  • physical_address physical_page_numoffset

29
Pros and Cons of Paged Page Tables
  • Can be generalized into multi-level paging
  • - Multiple memory lookups are required to
    translate a virtual address
  • Can be accelerated with translation lookaside
    buffers (TLBs)
  • Stores recently translated memory addresses for
    short-term reuses

30
Hashed Page Tables
  • Physical_address hash(virtual_address)
  • Ideal for large virtual addresses (e.g. the
    current 64-bit architecture). Why?
  • Conceptually simple
  • - Need to handle collisions
  • - Need one hash table per address space

31
Inverted Page Table
  • Traditional paging system
  • One slot for each virtual address, used or not
  • A very large number of total table entries
  • Inverted page table
  • One entry per physical page
  • One page table for the whole system
  • Used in some 64-bit systems (UltraSPARC, PowerPC,
    etc)

32
Inverted Page Table
  • Example (IBM RT)
  • Virtual address ltpid, page-number, offsetgt
  • Page table entry ltpid, page-numbergt
  • For each address
  • Search the page table entry for ltpid,
    page-numbergt
  • If found, ltI, offsetgt is the physical address
  • If not found, address not in physical memory
  • Table search can be time consuming. It is
    typically based on hashing.

33
Search in inverted page table example
  • Steps
  • Hash PID and virtual page number for an index to
    HAT
  • Lookup physical frame number in the HAT
  • Look at the inverted page table entry. If yes,
    done Otherwise, follow the hash chain

34
Inverted Page Table
  • The number of page table entry is proportional
    to the size of physical RAM
  • - Collision handling
  • - Hard to do shared memory (multiple pid mapping
    to the same physical address).
Write a Comment
User Comments (0)
About PowerShow.com