What is the main purpose of paging in an operating system?
Paging helps divide a program's memory into fixed-size blocks called pages, allowing efficient and flexible use of physical memory without needing contiguous space.
Click to reveal answer
beginner
Define a page table in the context of paging.
A page table is a data structure used by the operating system to map virtual page numbers to physical frame numbers in memory.
Click to reveal answer
intermediate
Why does paging help prevent external fragmentation?
Because memory is divided into fixed-size pages and frames, any free frame can be used for any page, so memory does not need to be contiguous, avoiding gaps between allocated blocks.
Click to reveal answer
intermediate
What information is typically stored in a page table entry?
Each entry usually contains the frame number where the page is stored, and status bits like valid/invalid, access permissions, and whether the page is in memory or on disk.
Click to reveal answer
intermediate
Explain how a virtual address is translated to a physical address using paging.
The virtual address is split into a page number and an offset. The page number is used to look up the frame number in the page table. The physical address is then the frame number combined with the offset.
Click to reveal answer
What is the size relationship between a page and a frame in paging?
APages and frames are the same size
BPages are larger than frames
CFrames are larger than pages
DPages and frames can be any size
✗ Incorrect
Pages and frames must be the same size so that any page can fit into any frame.
What does a page table entry NOT typically contain?
AValid/invalid bit
BFrame number
CPage size
DAccess permissions
✗ Incorrect
Page size is fixed and known system-wide, so it is not stored in each page table entry.
Which problem does paging help to solve?
AExternal fragmentation
BCPU scheduling
CFile system organization
DNetwork communication
✗ Incorrect
Paging eliminates external fragmentation by allowing non-contiguous memory allocation.
In paging, what is the 'offset' part of a virtual address used for?
ATo find the page number
BTo find the frame number
CTo check access permissions
DTo find the exact location within a page
✗ Incorrect
The offset specifies the exact byte within the page.
If a page is not currently in physical memory, what does the page table entry indicate?
AThe page is corrupted
BThe page is invalid or on disk
CThe page is locked in memory
DThe page is in the CPU cache
✗ Incorrect
The valid/invalid bit shows if the page is in memory or needs to be fetched from disk.
Describe how paging works to translate a virtual address to a physical address.
Think about how the system finds the real memory location from a virtual address.
You got /4 concepts.
Explain the role and structure of a page table in memory management.
Consider what information the OS needs to find where a page is stored.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of paging in an operating system?
easy
A. To encrypt data in memory
B. To increase the CPU clock speed
C. To manage input/output devices
D. To divide memory into fixed-size blocks called pages
Solution
Step 1: Understand the concept of paging
Paging divides the computer's memory into fixed-size blocks called pages to simplify memory management.
Step 2: Identify the main purpose
The main goal is to break memory into pages, not to affect CPU speed, encryption, or device management.
Final Answer:
To divide memory into fixed-size blocks called pages -> Option D
Quick Check:
Paging = dividing memory into pages [OK]
Hint: Paging means splitting memory into equal blocks [OK]
Common Mistakes:
Confusing paging with CPU speed improvement
Thinking paging encrypts memory data
Mixing paging with device management
2. Which of the following correctly describes a page table?
easy
A. A table that stores the mapping from virtual pages to physical frames
B. A list of all running processes in the system
C. A table that stores CPU instructions
D. A list of input/output devices connected to the system
Solution
Step 1: Define the role of a page table
A page table maps virtual memory pages to physical memory frames, helping the OS locate data.
Step 2: Eliminate incorrect options
Page tables do not list processes, CPU instructions, or devices.
Final Answer:
A table that stores the mapping from virtual pages to physical frames -> Option A
Quick Check:
Page table = virtual to physical mapping [OK]
Hint: Page tables map virtual pages to physical memory [OK]
Common Mistakes:
Confusing page tables with process lists
Thinking page tables store CPU instructions
Mixing page tables with device lists
3. Consider a system with a page size of 4 KB and a virtual address 0x1A3F. Which part of the address identifies the page number?
medium
A. The lower 12 bits
B. The middle 8 bits
C. The higher bits except the lower 12 bits
D. The entire 16 bits
Solution
Step 1: Calculate bits for page offset
Page size is 4 KB = 2^12 bytes, so lower 12 bits represent the offset within a page.
Step 2: Identify page number bits
The page number is given by the higher bits of the address excluding the lower 12 bits (offset).
Final Answer:
The higher bits except the lower 12 bits -> Option C
Quick Check:
Page number = address bits above offset bits [OK]
Hint: Page offset = log2(page size) bits; rest is page number [OK]
Common Mistakes:
Confusing offset bits with page number bits
Using entire address as page number
Selecting wrong bit segments
4. A page table entry is missing for a virtual page, causing a page fault. What is the most likely cause?
medium
A. The CPU clock speed is too low
B. The page is not currently loaded in physical memory
C. The virtual address is invalid
D. The page size is too large
Solution
Step 1: Understand what causes a page fault
A page fault occurs when the page table does not have an entry for the requested virtual page, meaning it is not in physical memory.
Step 2: Eliminate unrelated causes
CPU speed, invalid address, or page size do not directly cause missing page table entries.
Final Answer:
The page is not currently loaded in physical memory -> Option B
Quick Check:
Page fault = missing page in physical memory [OK]
Hint: Page fault means page not in physical memory [OK]
Common Mistakes:
Blaming CPU speed for page faults
Assuming invalid address always causes page fault
Confusing page size with page fault cause
5. In a system with 32-bit virtual addresses and 4 KB page size, how many entries does a single-level page table have?