0
0
Operating Systemsknowledge~10 mins

Multi-level paging in Operating Systems - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Multi-level paging
Start: Virtual Address
Divide into multiple parts
Use first part to index first-level page table
Get address of second-level page table
Use second part to index second-level page table
Find frame number
Combine frame number with offset
Physical Address
Multi-level paging breaks a virtual address into parts to index multiple page tables step-by-step, reducing memory needed for page tables.
Execution Sample
Operating Systems
Virtual Address = [10 bits][10 bits][12 bits]
Level 1 index = first 10 bits
Level 2 index = next 10 bits
Offset = last 12 bits
This shows how a 32-bit virtual address is split for two-level paging: two indexes and an offset.
Analysis Table
StepActionInputResultExplanation
1Receive virtual address0x123456780x12345678Start with full virtual address
2Extract Level 1 indexBits 31-220x48First 10 bits used to index first-level page table
3Access first-level page tableIndex 0x48Pointer to second-level table at 0x2000Find second-level page table address
4Extract Level 2 indexBits 21-120x345Next 10 bits used to index second-level page table
5Access second-level page tableIndex 0x345Frame number 0x1A3Find physical frame number
6Extract offsetBits 11-00x678Last 12 bits used as offset in frame
7Combine frame number and offsetFrame 0x1A3 + offset 0x678Physical address 0x1A3678Final physical address computed
8End--Address translation complete
💡 Translation ends after combining frame number with offset to get physical address.
State Tracker
VariableStartAfter Step 2After Step 4After Step 6Final
Virtual Address0x123456780x123456780x123456780x123456780x12345678
Level 1 indexN/A0x480x480x480x48
Level 2 indexN/AN/A0x3450x3450x345
OffsetN/AN/AN/A0x6780x678
Physical AddressN/AN/AN/AN/A0x1A3678
Key Insights - 3 Insights
Why do we split the virtual address into multiple parts instead of using one big page table?
Splitting reduces memory usage by avoiding one huge page table; each smaller table is easier to manage and often sparse, as shown in steps 2 and 4 where indexes access smaller tables.
How do we know which bits to use for each level's index?
The virtual address is divided based on the number of bits needed to index each page table level; for example, 10 bits for each level in steps 2 and 4, matching the size of the page tables.
What happens if a page table entry is missing at any level?
If an entry is missing, the translation fails and causes a page fault; this is not shown in the table but would stop the process before step 7.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the Level 1 index extracted at step 2?
A0x678
B0x345
C0x48
D0x1A3
💡 Hint
Check the 'Result' column in row for step 2 in the execution_table.
At which step is the physical frame number found?
AStep 3
BStep 5
CStep 6
DStep 7
💡 Hint
Look for 'Frame number' in the 'Result' column in execution_table.
If the offset bits were 14 instead of 12, how would the execution_table change?
AStep 6 would extract 14 bits instead of 12
BLevel 1 index would be larger
CPhysical address would be smaller
DLevel 2 index would be 12 bits
💡 Hint
Check how offset bits are extracted at step 6 in execution_table.
Concept Snapshot
Multi-level paging splits a virtual address into parts.
Each part indexes a page table level.
This reduces memory for page tables.
Final physical address = frame number + offset.
Commonly used in modern OS memory management.
Full Transcript
Multi-level paging is a method to translate virtual addresses to physical addresses by breaking the virtual address into multiple parts. Each part is used to index a level of page tables. For example, a 32-bit virtual address can be split into two 10-bit indexes and a 12-bit offset. The first 10 bits select an entry in the first-level page table, which points to a second-level page table. The next 10 bits select an entry in the second-level page table, which gives the frame number. The last 12 bits are the offset within the frame. Combining the frame number and offset gives the physical address. This method saves memory by avoiding one large page table and instead using smaller tables. The execution table shows each step of this translation process with an example address 0x12345678. Key moments include understanding why splitting is done, how bits are divided, and what happens if entries are missing. The visual quiz tests understanding of indexes and steps in the process.