You are on page 1of 13

Virtual Memory

Lecture 2
Virtual Memory

• Definition
• Capabilities
• Amount
Chapter 1
Protection – Virtual Memory
How it works?
Physical Addressing
• Every address generated by a running process
refers directly to physical memory.
Chapter 1
Protection – Virtual Memory
How it works?
Virtual Addressing
• Every address generated by a running process
refers to an instruction/data in virtual address
space (VAS)
Chapter 1
Protection – Virtual Memory

Paging
• The VAS is divided into fixed size blocks called pages.
• The PAS is divided into fixed size blocks known as page frames.
Size of Page = Size of Page Frame
At any point in time, the set of virtual pages is
partitioned into three disjoint subsets

• Unallocated
• Cached
• Uncached
Design Issues for DRAM
• Organization of the DRAM cache is driven
entirely by the enormous cost of misses because
of:
• large miss penalty
• expense of accessing the first byte
• Consequently:
• Virtual Page tend to be large - 4KB to 8KB
• DRAM caches are fully associative
• DRAM uses write-back policy instead of write-
through
Write back
• Writing is done only to the DRAM.
• A modified page is written back to the store, just
before it is replaced.
Write-through
• When data is updated, it is written to both the
DRAM and the secondary storage
Virtual Memory

Address Translation
Virtual Memory
Page Tables
• An array of Page Table Entries (PTEs)
• Answers the following questions:
• Is a page present in DRAM?
• If yes, in which frame?
• If no, then where on disk?

• Each page in the VAS of a process has a corresponding entry in the Page table at a fixed offset
• Each process has a separate page table
Typical Page Table Entry

V : Valid bit
if ON => the page is cached and the frame number bits can be read
if OF => the page is uncached and the disk address field may be read
M : modify bit
On replacement, if a particular page has M = 0, it is simply overwritten by the incoming page.
Address
Translation

You might also like