Virtual memory
Virtual memory (VM) is an abstract concept of main memory. is a hardware, hardware address translation, storage, disk files and the perfect interaction between the kernel software. He provides a large, consistent, and private address space for each process.
- It stores a cache of address space stored on disk, storing only the active area in main memory, and transferring data back and forth between the disk and main memory as needed to prevent other processes from being available without the main memory space.
- It simplifies storage management by providing a consistent address space for each process.
- It protects the address space of each process from being destroyed by other processes.
Physical addressing and virtual addressing
The main memory of a computer system consists of several bytes, each of which has a unique physical address. This physical Cunging is still used in digital signal processing, embedded microcontrollers, and Cray supercomputers. The modern processor uses the addressing method of virtual addressing.
Virtual memory as a tool for caching
The virtual memory is organized into an array of n contiguous byte sizes stored on disk, each with a unique virtual address, and the contents of the array on disk are cached in storage. The VM system splits the virtual memory into virtual pages, and the physical memory is split into physical pages.
Three disjoint subsets of a virtual page:
- Unassigned: The VM system has no allocated pages and does not occupy disk space.
- Cached: The currently slow presence of allocated pages in physical memory.
- Not cached: The allocated pages in the physical memory are not being slowed.
Page table:
Used to determine if a virtual page is somewhere in the DRAM. Using the data structure of the page table, the virtual pages are mapped to physical pages, and each time the address translation hardware translates a virtual address into a physical address, the page table is read and the operating system is responsible for maintaining the contents of the page table. (Pte represents a fixed offset in the page table for each page in the virtual address space)
Page Hits:
Indicates that while the CPU reads a word from the VPN, the VPN is cached in DRAM, and address translation should take the virtual address as a lure to locate the PTEN and read.
Page fault
The cache is not hit. Call the T-page exception handler, select a sacrifice for the PPT, if the VPT has been modified to copy back to the disk, then the VPN into the PPT, and modify the page table entries.
Allocation page:
The operating system allocates a new virtual memory page, creates space on the disk, and updates the pten so that he points to the newly created page on disk. thereby assigning a VPN.
Locality:
At any point in time, the program tends to work on a smaller set of active pages (working set), where the initial overhead is to dispatch the Working set page to storage, and the next reference to the working set will result in a hit, without generating additional disk traffic.
csapp--Virtual Memory