




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















9: Virtual Memory 1
9: Virtual Memory 2
9: Virtual Memory 4
Definitions
9: Virtual Memory 5
Demand Paging
9: Virtual Memory 7
Demand Paging
9: Virtual Memory 8
9: Virtual Memory 10
Demand Paging
9: Virtual Memory 11
The Picture When All
Pages Are Not In Memory
pmap on linux shows where these pages get mapped.
“pmap –x
Check out also “lsof”
9: Virtual Memory 13
When memory is overallocated, we can either swap out some process, or overwrite some pages. Which pages should we replace?? <--- here the goal is to minimize the number of faults.
Here is an example reference string we will use to evaluate fault mechanisms:
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
Conceptually easy to implement; either use a time-stamp on pages, or organize on a queue. (The queue is by far the easier of the two methods.)
9: Virtual Memory 14
9: Virtual Memory 16
Using another string:
9: Virtual Memory 17
Uses a reference bit set by hardware when the page is touched. Then when a fault occurs, pick a page that hasn't been referenced.
Additional reference bits can be used to give some time granularity. Then pick the page with the oldest timestamp.
Second chance replacement: pick a page based on FIFO. If its reference bit is set, give it another chance. Envision this as a clock hand going around a circular queue. The faster pages are replaced, the faster the hand goes.
Maintain a modified bit, and preferentially replace unmodified pages.
9: Virtual Memory 19
9: Virtual Memory 20