当前位置:
文档之家› 伦敦大学学院-计算机系统 (12)
伦敦大学学院-计算机系统 (12)
Translation Lookaside Buffer (TLB)
¢ A small cache of page table entries with fast access by MMU
TLB
2
PTE
VPN
3
VA
CPU
MMU
1
PA
4
Cache/
Memory
Data 5
Typically, a TLB hit eliminates the k memory accesses required to do a page table lookup.
1
Carnegie Mellon
Review: Virtual Memory & Physical
Memory
Virtual address
Physical page
number or
Valid disk address
PTE 0 0
null
1101 Nhomakorabea0
null
0
PTE 7 1
Memory resident page table (DRAM)
Virtual Memory Implementation
Brad Karp UCL Computer Science
Carnegie Mellon
CS 3007 20th February 2018
(lecture notes derived from material from Phil Gibbons, Dave O’Hallaron, and Randy Bryant)
Physical memory (DRAM)
VP 1
PP 0
VP 2
VP 7
VP 4
PP 3
Virtual memory (disk)
VP 1 VP 2 VP 3 VP 4 VP 6 VP 7
¢ A page table contains page table entries (PTEs) that map virtual pages to physical pages.
(bits per field for our simple example)
6
Today
¢ Simple memory system example ¢ Case study: Core i7/Linux memory system ¢ Memory mapping
Carnegie Mellon
¢ Components of the physical address (PA)
§ PPO: Physical page offset (same as VPO) § PPN: Physical page number § CO: Byte offset within cache line § CI: Cache index § CT: Cache tag
Carnegie Mellon
Review of Symbols
¢ Basic Parameters
§ N = 2n : Number of addresses in
virtual address space
§ M = 2m : Number of addresses in
physical address space
7
Carnegie Mellon
Simple Memory System Example
¢ Addressing
§ 14-bit virtual addresses § 12-bit physical address § Page size = 64 bytes
13 12 11 10 9 8 7 6 5 4 3 2 1 0
§ P = 2p : Page size (bytes)
¢ Components of the virtual address (VA)
§ TLBI: TLB index § TLBT: TLB tag § VPO: Virtual page offset § VPN: Virtual page number
2
Carnegie Mellon
Translating with a k-level Page Table
¢ Having multiple levels greatly reduces page table size
Page table base register (part of the process’ context)
at offset
S = 2s sets
Address of word:
t bits s bits b bits
CT
CI CO
tag index offset
data begins at this offset
v
tag
012
B-1
valid bit
B = 2b bytes per cache block (the data) 5
n-1 VPN 1
VIRTUAL ADDRESS
VPN 2
...
VPN k
p-1
0
VPO
the Level 1 a Level 2 page table page table
... ...
a Level k page table
PPN
m-1 PPN
p-1
0
PPO
PHYSICAL ADDRESS
3
Carnegie Mellon
¢ 16 entries
¢ 4-way associative
TLBT
TLBI
13 12 11 10 9 8 7 6 5 4 3 2 1 0
VPN
VPO
Translation Lookaside Buffer (TLB)
4
Carnegie Mellon
Set Associative Cache: Read
E = 2e lines per set
• Locate set • Check if any line in set
has matching tag • Yes + line valid: hit • Locate data starting
VPN Virtual Page Number
VPO Virtual Page Offset
11 10 9 8 7 6 5 4 3 2 1 0
PPN Physical Page Number
PPO Physical Page Offset
8
Carnegie Mellon
Simple Memory System TLB