Virtual Memory : Introduction to Virtual Memory

Virtual memory is a memory management technique that provides an idealized abstraction of the storage resources that are actually available on a given machine, which creates the illusion to users of a very large (main) memory. We can also say that the virtual memory is a technique that allows the execution of processes that may not be completely in memory. The virtual memory is implemented using both hardware (MMU) and software (operating system). It abstracts from the real memory available on a system by introducing the concept of virtual address space, which allows each process thinking of physical memory as a contiguous address space (or collection of contiguous segments). This technique is useful as large virtual memory is provided for user programs when a very small physical memory is there.

Computers have a finite amount of RAM so memory can run out, especially when multiple programs run at the same time. A system using virtual memory can load larger programs or multiple programs running at the same time, allowing each one to operate as if it has infinite memory and without having to purchase more RAM. Virtual memory serves two purposes. First, it allows us to extend the use of physical memory by using disk. Second, it allows us to have memory protection, because each virtual address is translated to a physical address.

We know that the execution time address-binding scheme results in an environment where the logical and physical addresses differ. In this case we usually refers to the logical address as a virtual address. When we examine several real programs we find that in many cases, the entire program does not needed. For example :

  • Programs that have code to handle those type of errors that do not frequently occur. Hence this code is very rarely executed.
  • In many programs the static data structures such as arrays, tables and lists are often allocated more memory than actually required. For example in array implementation of Queue we may declare maximum array size to 100 through most of the time it contains only 50 elements at the most.

It may also be the case, where the whole program is required, but it may not all be needed at the same time. If operating system can achieve the ability to execute a program that is not completely in memory it would have many benefits :
  • The operating system can support a user request to run large number of programs even though the size of the main memory is limited. That means programmers need not to worry about the size of the physical memory available. The programmer can write programs for an extremely large virtual address space, simplifying the programming task. 
  • Because each program can run in the less physical memory, more programs can reside in memory and could be run by the CPU results in increasing CPU utilization and throughput.
  • Since at one time only a part of the program is to be loaded into memory it reduces I/O operations. Hence each user program would run faster.

Virtual memory is that technique which supports above mentioned features. Virtual memory is the separation of user logical memory physical memory.




Next Topic :

No comments:

Post a Comment