Memory Management, Paging and Virtual Memory Notes for Gate Cs
Memory Management, Paging and Virtual Memory notes for GATE CS: 47 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice que
Memory Management Paging and Virtual Memory notes
Topic Boundary and Anchor Scenario
Topic Boundary & Anchor Scenario
This topic covers paging mechanics, page table structures, address translation arithmetic, Translation Lookaside Buffer (TLB) operation, and Effective Access Time (EAT). It explicitly excludes page replacement algorithms, page fault handling procedures, and contiguous memory allocation, which are owned by sibling topics. We will use a consistent anchor scenario: a system with a 32-bit virtual address, 20-bit physical address, 4 KB page size, 4-byte Page Table Entries (PTEs), and a 64-entry 2-way set-associative TLB.
Explain this more simply
Think of this anchor scenario as a controlled laboratory setup. Every calculation we perform will use these exact numbers. This prevents cognitive overload from constant unit conversions and allows you to isolate the specific mechanism being tested in each card.
Go one level deeper
The anchor scenario is deliberately chosen because a 32-bit virtual address with 4 KB pages yields exactly 220 entries. This cleanly maps to a 4 MB single-level page table, exposing the precise mathematical threshold where multi-level structures become mandatory, without introducing messy fractional page allocations.
Virtual versus Physical Address Space
Virtual vs Physical Address Space
Virtual Address: Index into logical memory space. Physical Address: Index into actual hardware RAM.
Anchor: 32-bit VA (4 GB) vs 20-bit PA (1 MB)
A virtual address is an index into a process's logical memory space, while a physical address is an index into the actual hardware RAM. In our anchor scenario, the 32-bit virtual address allows a process to request up to 4 GB of memory (232 bytes). However, the 20-bit physical address means the machine only has 1 MB of actual RAM installed (220 bytes).
Explain this more simply
Imagine a library catalog versus the actual bookshelves. The catalog can list millions of books, even if the building only has physical space for a few hundred. The operating system maps the catalog entries to the available shelves dynamically.
Go one level deeper
The hardware does not care if the virtual address space exceeds the physical address space. The Memory Management Unit (MMU) blindly performs the translation. If the target physical frame is absent or invalid, the MMU raises a trap, delegating the resolution to the operating system's page fault handler.
Page Table Entry Bit Interpretation
Page Table Entry Bit Interpretation
A Page Table Entry (PTE) is not merely a physical frame number. It contains control bits that dictate hardware behavior. The valid bit indicates whether the page is currently resident in physical memory. The dirty bit indicates whether the page has been modified, signaling that it must be written to disk before being replaced. Protection bits enforce read, write, or execute permissions.
Explain this more simply
Consider a PTE as a security badge for a specific page. The badge not only tells you which room (frame) the page belongs to, but also whether the badge is currently active (valid), whether the occupant has made a mess (dirty), and what actions they are allowed to perform (protection).
Go one level deeper
The MMU checks these bits during every translation. A missing valid bit triggers a page fault trap. A violated protection bit (e.g., writing to a read-only page) triggers a segmentation fault trap. The operating system, not the MMU, handles the subsequent software-level resolution.
44 more cards in this chapter
Try a question
Answer it here to see how it works. Nothing is recorded until you sign in.
Question 1
Level 1: Warm-up
Assertion (A): A program with 15 memory accesses and 9 page faults has a page fault rate of 0.6.
Reason (R): Page fault rate is calculated as Total Page Faults divided by Total Memory Accesses.
Options:
A) Both A and R are true and R is the correct explanation of A
B) Both A and R are true but R is not the correct explanation of A
C) A is true but R is false
D) A is false but R is true
Question 2
Level 1: Warm-up
Assertion (A): In the LRU worked example with reference string [7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1] and 4 page frames, there are 9 page faults.
Reason (R): The page fault rate is calculated as Total Page Faults divided by Total Memory Accesses.
Options:
A) Both A and R are true and R is the correct explanation of A
B) Both A and R are true but R is not the correct explanation of A
C) A is true but R is false
D) A is false but R is true
Question 3
Level 1: Warm-up
A system uses a page size of 4 KB. A process accesses virtual address 8196 (in decimal). The page table maps this virtual page to physical frame number 5. The corresponding physical address in decimal is
Question 4
Level 1: Warm-up
Assertion (A): In a two-level page table with a 32-bit virtual address, 4 KB page size, and 4-byte page table entries, the outer page table index is 10 bits and the inner page table index is 10 bits. Reason (R): Each page table must fit exactly in one 4 KB page, and since each entry is 4 bytes, a page can hold 1024 entries, requiring 10 bits for each index.
Question 5
Level 1: Warm-up
Consider the following statements about the Least Recently Used (LRU) page replacement algorithm:
S1: LRU is a stack algorithm.
S2: LRU can exhibit Belady's anomaly.
S3: LRU requires hardware support to track usage history.
Which of the statements is/are true?
Options:
A) S1 only
B) S1 and S3 only
C) S2 and S3 only
D) S1, S2, and S3
Question 6
Level 1: Warm-up
Consider the following statements about manually tracing the Least Recently Used (LRU) page replacement algorithm:
S1: To find the victim page, you look backward in the reference string from the current position.
S2: On a hit, the accessed page is moved to the most recently used position.
S3: The page whose last occurrence is furthest back in the reference string is the LRU victim.
Which of the statements is/are true?
Options:
A) S1 only
B) S1 and S2 only
C) S2 and S3 only
D) S1, S2, and S3
Question 7
Level 1: Warm-up
Consider a system with a 32-bit virtual address space, a 20-bit physical address space, and a page size of 4 KB. Each page table entry is 4 bytes. Which of the following statements about the single-level page table is/are TRUE?
Question 8
Level 1: Warm-up
Consider the following statements about single-level page table size: S1: It depends on the virtual address space size. S2: It depends on the physical address space size. S3: It depends on the page size. S4: It depends on the page table entry size.
Which of the above statements is/are TRUE?
Question 9
Level 1: Warm-up
A system uses a 32-bit virtual address space and a page size of 4 KB. The single-level page table must be capable of mapping every possible virtual page. The number of entries required in this page table is
Question 10
Level 1: Warm-up
In the anchor scenario (32-bit virtual address, 20-bit physical address, 4 KB page size, 4-byte page table entries), the single-level page table is deliberately sized to expose the threshold where multi-level paging becomes mandatory. The size of this page table is
Free preview ends here
Login to view the complete notes
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Built around you, not around a syllabus PDF
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
Revision that hits your weak spots
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Questions calibrated to the real exam
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Notes written for recall, not for volume
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
One place for everything
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
Honest progress
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Unlock the whole course
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.
Memory Management, Paging and Virtual Memory Notes for GATE CS
Memory Management, Paging and Virtual Memory notes for GATE CS: 47 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.
Topic Boundary and Anchor Scenario
Topic Boundary & Anchor Scenario
This topic covers paging mechanics, page table structures, address translation arithmetic, Translation Lookaside Buffer (TLB) operation, and Effective Access Time (EAT). It explicitly excludes page replacement algorithms, page fault handling procedures, and contiguous memory allocation, which are owned by sibling topics. We will use a consistent anchor scenario: a system with a 32-bit virtual address, 20-bit physical address, 4 KB page size, 4-byte Page Table Entries (PTEs), and a 64-entry 2-way set-associative TLB.
Explain this more simply
Think of this anchor scenario as a controlled laboratory setup. Every calculation we perform will use these exact numbers. This prevents cognitive overload from constant unit conversions and allows you to isolate the specific mechanism being tested in each card.
Go one level deeper
The anchor scenario is deliberately chosen because a 32-bit virtual address with 4 KB pages yields exactly 220 entries. This cleanly maps to a 4 MB single-level page table, exposing the precise mathematical threshold where multi-level structures become mandatory, without introducing messy fractional page allocations.
Virtual versus Physical Address Space
Virtual vs Physical Address Space
Virtual Address: Index into logical memory space. Physical Address: Index into actual hardware RAM.
Anchor: 32-bit VA (4 GB) vs 20-bit PA (1 MB)
A virtual address is an index into a process's logical memory space, while a physical address is an index into the actual hardware RAM. In our anchor scenario, the 32-bit virtual address allows a process to request up to 4 GB of memory (232 bytes). However, the 20-bit physical address means the machine only has 1 MB of actual RAM installed (220 bytes).
Explain this more simply
Imagine a library catalog versus the actual bookshelves. The catalog can list millions of books, even if the building only has physical space for a few hundred. The operating system maps the catalog entries to the available shelves dynamically.
Go one level deeper
The hardware does not care if the virtual address space exceeds the physical address space. The Memory Management Unit (MMU) blindly performs the translation. If the target physical frame is absent or invalid, the MMU raises a trap, delegating the resolution to the operating system's page fault handler.
Page Table Entry Bit Interpretation
Page Table Entry Bit Interpretation
A Page Table Entry (PTE) is not merely a physical frame number. It contains control bits that dictate hardware behavior. The valid bit indicates whether the page is currently resident in physical memory. The dirty bit indicates whether the page has been modified, signaling that it must be written to disk before being replaced. Protection bits enforce read, write, or execute permissions.
Explain this more simply
Consider a PTE as a security badge for a specific page. The badge not only tells you which room (frame) the page belongs to, but also whether the badge is currently active (valid), whether the occupant has made a mess (dirty), and what actions they are allowed to perform (protection).
Go one level deeper
The MMU checks these bits during every translation. A missing valid bit triggers a page fault trap. A violated protection bit (e.g., writing to a read-only page) triggers a segmentation fault trap. The operating system, not the MMU, handles the subsequent software-level resolution.
Generally, for any virtual address, we split it into the page number and the offset based on the page size. The page number indexes the page table to retrieve the physical frame number, and the final physical address is the frame number concatenated with the original offset.
Explain this more simply
Suppose the virtual address is 0x12345678 and the page size is 4 KB. The lower 12 bits (0x678) are the offset. They remain completely unchanged during translation. The upper 20 bits (0x12345) are the page number. We look up page 0x12345 in the page table, find it maps to frame 0xABC, and construct the physical address as 0xABC678.
Go one level deeper
The offset is never translated. It is a direct pass-through from the virtual address to the physical address. This is why the page size must be identical for both virtual and physical memory; otherwise, the offset boundary would not align, breaking the concatenation logic.
Memory Management, Paging and Virtual Memory: Solved Questions with Step-by-Step Explanations (10 Problems)
Question 1 · Operating SystemMCQ
Assertion (A): A program with 15 memory accesses and 9 page faults has a page fault rate of 0.6.
Reason (R): Page fault rate is calculated as Total Page Faults divided by Total Memory Accesses.
Options:
A) Both A and R are true and R is the correct explanation of A
B) Both A and R are true but R is not the correct explanation of A
C) A is true but R is false
D) A is false but R is true
A.
Both A and R are true and R is the correct explanation of A
B.
Both A and R are true but R is not the correct explanation of A
C.
A is true but R is false
D.
D) A is false but R is true
Correct Answer:
A
Step-by-Step Solution
Key idea: Verify both the assertion and reason, then check if the reason correctly explains the assertion.
Step 1: Evaluate Assertion (A). Page fault rate = 9 / 15 = 0.6. The assertion is true.
Step 2: Evaluate Reason (R). The formula for page fault rate is indeed Total Page Faults / Total Memory Accesses. The reason is true.
Step 3: Check if R explains A. The reason provides the exact formula used to calculate the value in the assertion. Therefore, R is the correct explanation of A.
Answer: Both A and R are true and R is the correct explanation of A (Option A)
Question 2 · Operating SystemMCQ
Assertion (A): In the LRU worked example with reference string [7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1] and 4 page frames, there are 9 page faults.
Reason (R): The page fault rate is calculated as Total Page Faults divided by Total Memory Accesses.
Options:
A) Both A and R are true and R is the correct explanation of A
B) Both A and R are true but R is not the correct explanation of A
C) A is true but R is false
D) A is false but R is true
A.
Both A and R are true and R is the correct explanation of A
B.
Both A and R are true but R is not the correct explanation of A
C.
A is true but R is false
D.
A is false but R is true
Correct Answer:
B
Step-by-Step Solution
Key idea: Verify both the assertion and reason, then check if the reason explains the assertion.
Step 1: Evaluate Assertion (A). The worked example traces LRU with the given reference string and 4 frames, resulting in 9 page faults out of 15 accesses. The assertion is true.
Step 2: Evaluate Reason (R). The formula for page fault rate is indeed Total Page Faults / Total Memory Accesses. The reason is true.
Step 3: Check if R explains A. The reason provides the general formula for calculating page fault rate, but it doesn't explain WHY there are 9 faults in the specific trace. The number of faults depends on the LRU algorithm's behavior with that specific reference string, not just the formula.
Step 4: Therefore, both are true but R is not the correct explanation of A.
Answer: Both A and R are true but R is not the correct explanation of A (Option B)
Question 3 · Operating SystemNAT
A system uses a page size of 4 KB. A process accesses virtual address 8196 (in decimal). The page table maps this virtual page to physical frame number 5. The corresponding physical address in decimal is
Correct Answer:
20484
Step-by-Step Solution
Key idea: Physical address = (frame number × page size) + offset. The offset is the same in virtual and physical addresses.
Assertion (A): In a two-level page table with a 32-bit virtual address, 4 KB page size, and 4-byte page table entries, the outer page table index is 10 bits and the inner page table index is 10 bits. Reason (R): Each page table must fit exactly in one 4 KB page, and since each entry is 4 bytes, a page can hold 1024 entries, requiring 10 bits for each index.
A.
Both A and R are true and R is the correct explanation of A.
B.
Both A and R are true but R is NOT the correct explanation of A.
C.
A is true but R is false.
D.
A is false but R is true.
Correct Answer:
A
Step-by-Step Solution
Key idea: The index bits are determined by how many entries fit in a single page frame.
Step 4: The 20-bit page number is split into two 10-bit indices for the outer and inner tables. Assertion A is TRUE.
Step 5: R correctly explains why A is true.
Answer: Both A and R are true and R is the correct explanation of A.
Question 5 · Operating SystemMCQ
Consider the following statements about the Least Recently Used (LRU) page replacement algorithm:
S1: LRU is a stack algorithm.
S2: LRU can exhibit Belady's anomaly.
S3: LRU requires hardware support to track usage history.
Which of the statements is/are true?
Options:
A) S1 only
B) S1 and S3 only
C) S2 and S3 only
D) S1, S2, and S3
A.
S1 only
B.
S1 and S3 only
C.
S2 and S3 only
D.
S1, S2, and S3
Correct Answer:
B
Step-by-Step Solution
Key idea: LRU is a stack algorithm that approximates Optimal using past behavior and requires hardware support.
Step 1: Evaluate S1. LRU is a stack algorithm because the set of pages in memory with N frames is always a subset of pages in memory with N+1 frames. S1 is true.
Step 2: Evaluate S2. Stack algorithms (including LRU) are mathematically guaranteed to never exhibit Belady's anomaly. S2 is false.
Step 3: Evaluate S3. LRU requires hardware support (counters or a stack) to track the usage history of pages. S3 is true.
Step 4: Conclude that S1 and S3 are true.
Answer: S1 and S3 only (Option B)
Question 6 · Operating SystemMCQ
Consider the following statements about manually tracing the Least Recently Used (LRU) page replacement algorithm:
S1: To find the victim page, you look backward in the reference string from the current position.
S2: On a hit, the accessed page is moved to the most recently used position.
S3: The page whose last occurrence is furthest back in the reference string is the LRU victim.
Which of the statements is/are true?
Options:
A) S1 only
B) S1 and S2 only
C) S2 and S3 only
D) S1, S2, and S3
A.
S1 only
B.
S1 and S2 only
C.
S2 and S3 only
D.
S1, S2, and S3
Correct Answer:
D
Step-by-Step Solution
Key idea: The manual LRU trace method uses backward looking to find the least recently used page.
Step 1: Evaluate S1. The manual method involves looking backward in the reference string from the current position to find which page was used least recently. S1 is true.
Step 2: Evaluate S2. On a hit, the accessed page becomes the most recently used, so it's moved to the MRU position in the tracking list. S2 is true.
Step 3: Evaluate S3. The LRU victim is the page whose last occurrence is furthest back in the reference string (or has no prior occurrence). S3 is true.
Step 4: All three statements correctly describe the manual LRU tracing method.
Answer: S1, S2, and S3 (Option D)
Question 7 · Operating SystemMSQ
Consider a system with a 32-bit virtual address space, a 20-bit physical address space, and a page size of 4 KB. Each page table entry is 4 bytes. Which of the following statements about the single-level page table is/are TRUE?
A.
The page table requires exactly 220 entries.
B.
The page table size is 1 MB.
C.
If the physical address space is increased to 24 bits, the page table size remains unchanged.
D.
If the page size is increased to 8 KB, the page table size becomes 2 MB.
Correct Answer:
["A","C","D"]
Step-by-Step Solution
Key idea: Page table size depends on virtual address space and page size, not physical address space.
Step 4: Changing physical address space does not affect the number of virtual pages. Statement C is TRUE.
Step 5: If page size = 8 KB = 213, entries = 232/213=219. Size = 219×4=221 bytes = 2 MB. Statement D is TRUE.
Answer: A, C, D
Question 8 · Operating SystemMSQ
Consider the following statements about single-level page table size: S1: It depends on the virtual address space size. S2: It depends on the physical address space size. S3: It depends on the page size. S4: It depends on the page table entry size.
Which of the above statements is/are TRUE?
Step 1: S1 is TRUE. VA space determines number of virtual pages.
Step 2: S2 is FALSE. Physical address space does not affect page table size.
Step 3: S3 is TRUE. Page size determines how many pages fit in VA space.
Step 4: S4 is TRUE. PTE size determines bytes per entry.
Step 5: True statements: S1, S3, S4.
Answer: S1, S3, and S4 only
Question 9 · Operating SystemMCQ
A system uses a 32-bit virtual address space and a page size of 4 KB. The single-level page table must be capable of mapping every possible virtual page. The number of entries required in this page table is
A.
28
B.
212
C.
220
D.
232
Correct Answer:
C
Step-by-Step Solution
Key idea: The number of page table entries is determined entirely by the virtual address space, not the physical memory.
Step 1: Virtual address space = 232 bytes.
Step 2: Page size = 4 KB = 212 bytes.
Step 3: Number of virtual pages = 232/212=220.
Step 4: Each virtual page needs exactly one page table entry, so the page table has 220 entries.
Answer: 220
Question 10 · Operating SystemMCQ
In the anchor scenario (32-bit virtual address, 20-bit physical address, 4 KB page size, 4-byte page table entries), the single-level page table is deliberately sized to expose the threshold where multi-level paging becomes mandatory. The size of this page table is
A.
1 MB
B.
4 MB
C.
16 MB
D.
256 KB
Correct Answer:
B
Step-by-Step Solution
Key idea: Page table size depends on virtual address space, not physical address space.