What is Virtual MemoryVirtual (or logical) memory is a concept that, when implemented by a computer and its operating system, allows programmers to use a very large range of memory or storage addresses for stored data. The computing system maps the programmer’s virtual addresses to real hardware storage addresses. Usually, the programmer is freed from having to be concerned about the availability of data storage. In addition to managing the mapping of virtual storage addresses to real storage addresses, a computer implementing virtual memory or storage also manages storage swapping between active storage (RAM) and hard disk or other high volume storage devices. Data is read in units called “pages” of sizes ranging from a thousand bytes (actually 1,024 decimal bytes) up to several megabytes in size.
The computer’s operating system, using a combination of hardware and software, maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory. Main storage, as seen by a process or task, appears as a contiguous address space or collection of contiguous segments. The operating system manages virtual address spaces and the assignment of real memory to virtual memory. Address translation hardware in the CPU, often referred to as a memory management unit or MMU, automatically translates virtual addresses to physical addresses. Software within the operating system may extend these capabilities to provide a virtual address space that can exceed the capacity of real memory and thus reference more memory than is physically present in the computer. This reduces the amount of physical storage access that is required and speeds up overall system performance.
Cache ram is very high-speed RAM chips which sit between the CPU and main memory. It stores (i.e., caches) memory accesses by the CPU. Cache ram helps to alleviate the gap between the speed of a CPU’s megahertz rating and the ability of RAM to respond and deliver data. It reduces the frequency that the CPU must wait for data from the main memory.
This section describes concepts of virtual memory, demand paging and various page replacement algorithms.
Virtual memory is a technique that allows the execution of processes which are not completely available in memory. The main visible advantage of this scheme is that programs can be larger than physical memory. Virtual memory is the separation of user logical memory from physical memory. This separation allows an extremely large virtual memory to be provided for programmers when only a smaller physical memory is available.
Following are the situations, when entire program is not required to be loaded fully in main memory.
- User written error handling routines are used only when an error occurred in the data or computation.
- Certain options and features of a program may be used rarely.
- Many tables are assigned a fixed amount of address space even though only a small amount of the table is actually used.
- The ability to execute a program that is only partially in memory would counter many benefits.
- Less number of I/O would be needed to load or swap each user program into memory.
- A program would no longer be constrained by the amount of physical memory that is available.
- Each user program could take less physical memory; more programs could be run the same time, with a corresponding increase in CPU utilization and throughput.
Virtual memory is commonly implemented by demand paging. It can also be implemented in a segmentation system. Demand segmentation can also be used to provide virtual memory.
I hope that you understand my post. if you like this post then share my post, and comment on my post if you have any suggestion or Queries related to Virtual Memory. Thank you!