LOGO
Virtual Memory
Nhóm 5
11070459 - Thái Tiểu Minh
11070460 - Nguyễn Kim Ngân
13070249 - Lê Minh Nam
13070250 - Trần Đức Nghĩa
13070251 - Phạm Ích Trí Nhân
13070247 - Trần Thị Mi
1
Contents
E. Examples
D. Protection
C. Segmentation
B. Replacement
A. Introduction
2
A. Introduction
Reasons for using virtual memory
Share main memory
Simplify memory management
Provide protection
What is a virtual memory?
Memory Hierarchy
Simplify memory management
5
1. Reason 3
Virtual memory :
One process can’t interfere with another
•
Because they operate in different address spaces
User process cannot access privileged information
•
Different sections of address spaces have different permissions
Provide protection
6
2. Memory Hierarchy
7
CPU
CPU
regs
regs
Cache
Memory
Memory
Disk
Disk
size:
speed:
$/Mbyte:
line size:
Controlled by operation system
Auto overlay
(+) Virtual continuous address space
(+) Size ~ disk size, speed ~ main mem speed
(+) Programmers don’t care about mem size run more larger processes.
9
3. Virtual Memory vs Cache
10
Contents
E. Examples
D. Protection
C. Segmentation
B. Replacement
A. Introduction
11
B. Replacement
Organization Fully assosiative
Replacement LRU
Write policy? Write back
TLB
What is TLB?
Benefit for mem access time?
14
4. TLB
15
Processor
TLB Cache
Main
Memory
miss
hit
data
hit
miss
Disk
Memory
OS Fault
Handler
page fault/
protection violation
Page
Table
data
virtual
addr.
physical
addr.
Page hit
4. Speeding up Translation with a TLB
“Translation Lookaside Buffer” (TLB)
TLB hit
TLB
Cache
.
4. Address Translation With a TLB
Contents
E. Examples
D. Protection
C. Segmentation
B. Replacement
A. Introduction
19
C. Segmentation
Classes :
Paging
Segmentation
Paged segmentation
Looking a block
Paging
Segmentation
Paged segmentation
Disk
Virtual
Addresses
Physical
Addresses
1. Page Table
23
Valid bit :
-
1 : page in main mem
-
0 : page in disk
8 pages
4 page frames
= 4 pages
2. Segmentation
Virtual memory = a set of segments
Identify : segment number, size
Logical address :
•
Segment offset ≤ Segment size
Main mem = segments (+ holes)
24
Segment number Seg offset
disk
mem
10, 4, 8, 18, 7, 9, 12 10, 4, 8, 8, 7, 9, 12 10, 4, 8, 8, 7, 9, 3
Next fit : 20KB – 18KB – 9KB
10, 4, 8, 18, 7, 9, 12 10, 4, 8, 8, 7, 9, 12 10, 4, 8, 8, 7, 12
25