1 Memory Systems Virtual Memory Lecture 25 Digital Design and Computer Architecture Harris & Harris...
-
date post
19-Dec-2015 -
Category
Documents
-
view
217 -
download
0
Transcript of 1 Memory Systems Virtual Memory Lecture 25 Digital Design and Computer Architecture Harris & Harris...
1
Memory SystemsMemory SystemsVirtual MemoryVirtual Memory
Lecture 25Digital Design and Computer Architecture
Harris & HarrisMorgan Kaufmann / Elsevier, 2007
3
The Memory HierarchyThe Memory Hierarchy
Cache
Main Memory
Virtual Memory
Capacity
Speed
Technology cost / GB Access time
SRAM ~ $10,000 ~ 1 ns
DRAM ~ $100 ~ 100 ns
Hard Disk ~ $1 ~ 10,000,000 ns
5
Virtual Memory OverviewVirtual Memory Overview
• Physical Memory acts as a cache for virtual memory.
• Page table maps virtual pages to physical pages.
• This mapping of virtual addresses to physical addresses is called address translation.
• Translation Lookaside Buffers (TLBs) speed up address translation.
6
Virtual and Physical AddressesVirtual and Physical Addresses
Physical Memory
Physical AddressesVirtual Addresses Address Translation
Hard Disk
7
Cache/Virtual Memory AnaloguesCache/Virtual Memory Analogues
Cache Virtual Memory
Block Page
Block Size Page Size
Block Offset Page Offset
Miss Page Fault
TagVirtual Page Number
8
Virtual Address TranslationVirtual Address Translation
Page OffsetPPN
11 10 9 ... 2 1 0
Page OffsetVPN
Virtual Address
Physical Address
Translation
30 29 28 ... 14 13 12
11 10 9 ... 2 1 026 25 24 ... 13 12
9
Virtual Address TranslationVirtual Address Translation
Physical Memory
PhysicalPage Number Physical Addresses
Virtual Memory
VirtualPage NumberVirtual Addresses
7FFF 0x7FFF000 - 0x7FFFFFF0x7FFE000 - 0x7FFEFFF
0x0000000 - 0x0000FFF0x0001000 - 0x0001FFF
7FFE
00010000
7FFFA7FFF9
0000600005
7FFFC7FFFB
7FFFE7FFFD
7FFFF
0000100000
0000300002
00004
0x7FFFF000 - 0x7FFFFFFF0x7FFFE000 - 0x7FFFEFFF0x7FFFD000 - 0x7FFFDFFF0x7FFFC000 - 0x7FFFCFFF0x7FFFB000 - 0x7FFFBFFF0x7FFFA000 - 0x7FFFAFFF
0x00005000 - 0x00005FFF
0x00003000 - 0x00003FFF
0x00001000 - 0x00001FFF
0x7FFF9000 - 0x7FFF9FFF
0x00006000 - 0x00006FFF
0x00004000 - 0x00004FFF
0x00002000 - 0x00002FFF
0x00000000 - 0x00000FFF
10
The Page TableThe Page Table
001 0x00001 0x7FFE00
001 0x0001001 0x7FFF00
V
VirtualAddress 0x00002 47C
Hit
PhysicalPage Number
1219
15 12
VirtualPage Number
Pag
e T
able
PageOffset
PhysicalAddress 0x7FFF 47C
11
Replacement PoliciesReplacement Policies
Page Table
VirtualPage Number
Physical
Page Number
7FFFA
0000600005
001 0x00001 0x7FFE 7FFFC
7FFFB
7FFFE7FFFD
7FFFF
0000100000
0000300002
00004
00
001 0x0001001 0x7FFF00
V
00007
13
Example TLBExample TLB
Hit1
V
=
01
15 15
15
=
Hit1Hit0
Hit
19 19
19
VirtualPage Number
PhysicalPage Number
Entry 1
1 0x7FFFD 0x0000 1 0x00002 0x7FFF
VirtualAddress 0x00002 47C
1219
VirtualPage Number
PageOffset
VVirtual
Page NumberPhysical
Page Number
Entry 0
12PhysicalAddress 0x7FFF 47C
TLB