Intermediate Topic 29 of 51 Operating Systems
Virtual Memory
Abstraction giving programs more address space than physical RAM.
How it works
Virtual memory gives each process its own large, private address space that the OS and hardware map onto physical memory and disk. Pages not currently needed can live on disk and are brought in on demand, so programs can exceed RAM size and multiple programs coexist safely. The mapping provides isolation, relocation and sharing, and uses page tables and TLBs for fast translation.
Step-by-step walkthrough
- Each program sees a large private address space.
- The MMU translates addresses to physical RAM.
- Only active pages occupy RAM.
- Inactive pages are kept on disk.
- A needed page is brought back when accessed.
Where it is used
Process isolation, running large applications, memory-mapped files, shared libraries, copy-on-write fork and lazy allocation depend on virtual memory.
Common pitfall
When working sets exceed physical memory, constant swapping slows the system dramatically. Virtual size is not the same as memory used, which confuses monitoring. Overcommitted memory may fail later when pages are actually touched. Understand resident set size, page faults and swap to diagnose performance problems.
Where it fits in the course
Virtual Memory is topic 29 of 51 in Operating Systems, rated Intermediate. It follows Segmentation. The next topic is Page Faults.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Operating Systems quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Operating Systems quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Virtual Memory?
Where do people use Virtual Memory?
What is the most common mistake with Virtual Memory?
What should I learn before this topic?
How can I practice it?
Is Virtual Memory hard to learn?
How long does it take to learn Virtual Memory?
Which topics are related to Virtual Memory?
What should I study after Virtual Memory?
Related topics
- Segmentation (Operating Systems)
- Page Faults (Operating Systems)
- Paging (Operating Systems)
- Page Replacement Algorithms (Operating Systems)
- Virtual Memory in Hardware (Computer Architecture & Logic)
- Manual Memory Management (Languages & Compilers)
- Virtual Machines in Cloud (Distributed Systems & Cloud)