Virtual memory managers are used to support applications execution. In the early institution of operating systems the application was loaded into the physical memory of the computer and ran on that memory system. Virtual memory management allows for multiple applications running simultaneously, management of the physical memory as well as the enhanced capacity and utilization of the memory by swapping resource allocations. The overall purpose of the virtual memory manager is to increase capability, capacity and efficiency of the use of the physical memory by allocating resources, taking advantage of fragmented memory and simplifies the organization of the application and data. This is accomplished by establishing virtual memory addresses that are mapped to the physical locations of the application’s data. Modern computer architecture utilizes virtual memory management as an integral part of hardware support and design. The benefits of virtual memory management range from protecting applications from interfering with each other’s processes, creating the ability to share resources and simultaneous access to memory.
Virtual and Physical Memory Management
Virtual memory and physical memory are similar in the essence that they support the applications need for data. Memory management is the task or effort to coordinate and control the memory of a computing system. This can be done by virtual memory management which is the utilization of address separation between the virtual memory and the physical memory allowing the separation of processes running and the overall efficiency of the coordinate memory use. The essence of memory management focuses on the ability to provide memory to applications and programs at their request in the most efficient method possible. Virtual memory and physical memory are similar in their primary objective but are need to work in conjunction to create a highly efficient and effective virtual memory management process.
When focusing on what each type of memory entails there are key differences between the two. These differences are centered on use and function. Physical memory is used to store the loaded data from the application or operating system. This is the actual location the data is stored and accessed. Prior to current memory management processes the physical memory location would become the storage and operational location for the application. The application would run from the physical location of the data. This provided the application with direct access to the physical memory as well as the privileges to the use of that memory resource. The management of that applications memory use ultimately migrated from the application to the operating system itself. This memory management process consumed the physical memory by the application and would eventually result in the overutilization of the physical memory and degraded performance. As computing requirements began to lean toward the need for multi-tasking of the computer’s memory as well as the need for multiple applications accessing the same data simultaneously, there was a need for either an increase in physical storage or a new technique or process to manage that physical memory (Saxena & Swift, 2010).
Virtual memory management allows the operating system to perform tasks that were not available with the direct physical memory management methods. Virtual memory management (VMM) creates virtual addresses that are mapped to physical locations. The physical memory is managed to perform at its maximum potential while remaining available to the application for usage. VMM allows multiple applications to reside and interact within the same physical memory location. This means that applications that would previously consume all of the physical resources could not coexist with other applications due to the effectiveness the virtual memory manager provides. The virtual memory manager also provides a masking technique that provides the ability to cloak the physical memory from the application so not to confuse the application and cause issues with application integrity and performance. The other important aspect of VMM is the use of swapping to increase capacity of the physical memory.
Using the virtual memory manager has become the standard operating procedure or best practice framework for utilization and maximization of memory. These benefits fall into different areas that allow for increased capacity, colocation of applications, simultaneous utilization and overall efficiency. The ability to share and fully utilize the computer’s memory also allowed for multitasking of those resources.
The physical memory and its use by multiple applications must be managed so that each application is performing to its optimal rate. When applications use the physical memory not only is the memory being used it is also undergoing memory fragmentation. This occurs when an application uses the physical memory and breaks the sections into smaller sections that results in scattered and small pieces of memory. These pieces are not large enough to be used and must rely on the consolidation of these fragments to build usable memory. The VMM provides a seamless transition for the application by providing the virtual address to a new physical location. The application is directed to the physical location and maximizes the physical memory.
As stated before another benefit of VMM is the ability to hide the management of the physical memory from the application. This illusion to the application provides the needed barrier for the operating system to move and allocated physical memory. This movement, consolidation and allocation are managed by the operating system but do not disrupt the application due to the alignment of the virtual addresses to the physical addresses. While the physical addresses are changing for optimization the virtual addresses are providing the seamless transition for the application to run without negative interference.
The import part of the VMM is the actual optimization and utilization of memory. When an application requires the use of the code and data it must actually reside on the physical memory. The capacity of the physical memory is a finite and limited resource that is fairly expensive in regard to its capacity. The VMM allows for the data and code to only be stored on the Random Access Memory (RAM) when the code or data is actually needed. This means that the utilization of the RAM is increased because the capacity is only being utilized for the data and code that needs to be accessed that the time it is required. The data or code can also be saved temporarily onto the hard disk and allows for the transference of code. This is referred to as swapping and this provides a large benefit to the amount of virtual memory available for use. The virtual memory is equal to the physical memory as well as the space used as a temporary storage location on the hard disk thus increasing the capacity by over double the amount of memory.
Data retrieval for usage relies on the access of that data from the physical memory. The virtual addresses allow the access to the physical memory. The virtual address is translated into the physical address through three separate components. The first is the Page directory index which acts as a directory for the physical memory to associate the address. The next is the page table index which provides the second layer of the address and shows where the table is located and is physically mapped. The tertiary portion is the Byte Index is the final information needed to directly locate the data on the physical memory. The page directory index is used to identify the page table; the page table index is used to map the physical location of the virtual memory page and the physical memory. If the physical address is not already mapped there is a handling exception that is invoked and the page is found and loaded onto the physical memory (AMD, 2008).
In regard to 32-bit and 64-bit there are different ways to translate the virtual addresses to physical addresses. Typically a system supports either a 32-bit or a 64-bit virtual address space. The reason for this is the fact that the size of the address is corresponding to the number of bits required to represent the largest address. The modern operating system can operate on 32 or 64-bit processors and both have similar approaches to the management of virtual memory. The first conceptual understand is that the VMM will allocate program memory for the applications at the time of loading. This will define the address space and provide a clear distinction on the location. The virtual memory manager must be able to map the virtual memory to the physical memory across the entire space of the RAM (Gorman, 2004). This is accomplished through segmentation or paging strategies. This allows the proper allocation so space in both the virtual and physical memory locations.
AMD-V. (2008). Nested Paging. Advanced Micro Devices White Paper. Retrieved from: http://developer.amd.com/wordpress/media/2012/10/NPT-WP-1%201-final-TM.pdf
Gorman, M. (2004). Understanding the linux virtual memory manager. Upper Saddle River: Pearson Prentice Hall
Saxena, M., & Swift, M. (2010). Flash vm: virtual memory management on flash. University of Wisconsin-Madison. Retrieved from: http://pages.cs.wisc.edu/~msaxena/papers/FlashVM-atc-10.pdf