0
Challenge · 88CS Fundamentals
Virtual memory, paging and the URL question
OSused in ~85% of apps
Two questions, and the last two of the course. One is why your program can use more memory than the machine has. The other is what happens when you type a URL and press enter, which is asked so often that not having an answer is itself the signal.
Core idea. Virtual memory gives every process the illusion of its own large, contiguous address space, mapped in fixed-size pages onto whatever real memory is free, with the rest kept on disk. The URL question is the same kind of answer: a chain of named steps, told at the depth the interviewer asks for.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
the same reference string, three policies
references: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
| frames | FIFO | LRU | optimal |
|---|---|---|---|
| 1 | 12 | 12 | 12 |
| 2 | 12 | 12 | 9 |
| 3 | 9 | 10 | 7 |
| 4 | 10 worse than above | 8 | 6 |
| 5 | 5 | 5 | 5 |
Read the FIFO column downwards. Going from 3 frames to 4 makes it worse, which is Belady's anomaly and is not a mistake in the table. LRU never does this, because the pages it holds with one more frame are always a superset of what it held before.
More memory usually helps and, for FIFO, is not guaranteed to.
↑ play a little first, then dig in