Loading...
A process can use logical addresses without owning one continuous region of physical RAM. Trace the address translation, then explain what happens when a required page is absent.
What you'll be able to do
Paging divides a process’s virtual address space into fixed-size pages and physical memory into equally sized frames. A page table records where a process’s pages are held and relevant status or access information. Pages next to each other logically need not occupy neighbouring physical frames.
Split a logical address into page number and offset. In a simplified byte-addressed model with four-byte pages, address 13 has page number 3 and offset 1, because 13=3×4+1. If page 3 maps to frame 6, the physical address is 6×4+1=25. The offset is preserved by this translation. State units and indexing before calculating.
Segmentation divides a program into meaningful variable-sized regions, such as code, stack or data. A simple segment table can hold a base address and limit for each segment. The offset must be within the allowed range before it is added to the base. Segments can express different access permissions for different logical parts.
Variable-sized allocation can leave gaps between regions, called external fragmentation. Fixed-size paging avoids that particular allocation problem but can waste part of a final page and needs translation metadata. Systems can combine techniques, so a comparison should describe these models rather than assert that every real operating system uses only one of them.
Virtual memory provides each process with a managed address space; not every page must be resident in RAM at every instant. If a referenced page is absent, a page fault transfers control to the operating system. The system may need to obtain the page from backing storage, choose a frame or replace another page, update the mapping and resume the instruction.
If a replaced page has been modified, it may need to be written back. Storage access is much slower than a normal RAM access, so frequent page movement can dominate execution. Thrashing describes excessive paging with little useful progress. Virtual memory helps manage allocation and protection and can support workloads larger than current RAM, but does not provide the speed of additional physical RAM.
Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.
Common mistakes to avoid
Key takeaways
Test yourself
Answer a few questions, then review anything you missed.
Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.