Virtual memory is a separation of user logical memory from physical memory.
- Only part of the program needs to be in memory during execution.
- Logical address space can be much larger than actual physical space.
- Allows address spaces to be shared by several processes.
- Allows for more efficient process creation.
- Virtual memory can be implemented via demand paging or demand segmentation.
Demand Paging
Bring a page into memory only when it is needed. This results in less memory used, less I/O, faster response, and more users.
When a page is needed:
- If the reference id is invalid: abort
- Otherwise: put it into memory
With each page table entry a valid-invalid bit is associated.
Virtual memory allows other benefits like:
- Copy on Write
- Memory mapped files