1. A first look
Virtual memory (VM) is a memory management technique used by operating systems to give each process the illusion of having its own dedicated memory space.
Let’s examine 3 problems of a physical memory:
- Not enough RAM to run Program
- Programs writing/reading over each other’s data (security)
- Programs may not fit together
To solve this -> Virtual Memory. Each program will have their own virtual memory space, separate from others program
But the downside is they can’t share data between program (icons,…).
2. How does it works?
- Virtual Memory: program sees
- Physical Memory: RAM
- Virtual Addresses (VA): program uses
- Physical Addresses (PA): hardware uses to talk to RAM (eg. 2GB RAM -> 0 - 2^31-1 physical addresses)
Here’s how does a program access memory:
- Program executes a load with VA
- Computer translates VA -> PA (Address translation)
- If PA is not in RAM -> seeking in Disk
- Computer then reading RAM using PA -> return data to the program
The data structure to map from VA to PA is called Page Table
Refs: