4.2.26 · HinglishOperating Systems

Multi-level page tables — why, overhead

1,631 words7 min readRead in English

4.2.26 · Coding › Operating Systems


WHY — humein iska zaroorat kyun hai?

KYA gadbad hoti hai? Chaliye flat table ka size compute karte hain.


HOW — multi-level kaise fix karta hai

Figure — Multi-level page tables — why, overhead

Overhead: space vs time


Common mistakes


Flashcards

Why is a single-level page table wasteful for a 32-bit space?
Isko har virtual page ke liye ek PTE chahiye ( entries = 4MB per process), chahe zyaadatar pages unused hon.
Size formula for a single-level table?
bytes, jahan =addr bits, , =PTE size.
Why does multi-level save space?
Unused regions directory mein sirf ek "not present" entry hoti hain, toh unki second-level tables kabhi allocate nahi hoti (sparsity → savings).
How do you split a virtual address for levels?
Bits add karo: (offset).
Why choose 10/10/12 for 32-bit, 4KB, 4B PTE?
Taaki har second-level table (1024×4B = 4KB) exactly ek page mein fit ho; baaki bits directory aur offset ko jaate hain.
Time cost of a -level table per memory reference?
accesses ( walk ke liye, 1 data ke liye) — TLB ke bina.
What hardware hides the walk cost?
TLB, jo VPN→PFN cache karta hai; ek hit page-table walk skip kar deta hai.
Worst-case space vs single-level?
Thoda bada — saari leaf tables ke upar directory page(s) add ho jaate hain; multi-level tab hi win karta hai jab sparse ho.
EAT formula with TLB hit rate ?
.

Recall Feynman: ek 12-saal ke bache ko explain karo

Socho ek giant hotel hai jisme ek million rooms hain, aur ek badi guest list hai jisme har room ke liye ek line hai — chahe woh empty ho. Woh list enormous hai aur mostly blank hai. Iske bajaye, hum ek chhoti floor directory rakhte hain: "Floor 3 mein guests hain, yeh rahi unki list; Floor 4 khali hai — koi list nahi." Kisi ko dhundhne ke liye tum floor directory check karte ho, phir us floor ki chhoti list. Tum sirf unhi floors ki lists rakhte ho jisme actually log hain. Kisi ko dhundhna do extra steps leta hai, toh hum ek sticky-note (TLB) rakhte hain un logon ka jo humne recently dhundhe hain, taaki jaldi jaa sakein.

Connections

Concept Map

size formula

32-bit example

scaled by processes

motivates

attacked by

top bits index

present entry points to

unused chunk becomes

skips allocating

requires

choose bits so

Flat single-level table

Table size = 2^V-p x E

4 MB per process

Mostly unused space

Used pages cluster in regions

Multi-level page tables

Page directory L1

Second-level tables L2

Not-present entry

VPN split into stages

L2 fits one page b = p - log2 E