What is Vertual Memory?

Virtual memory has become very common for most operating systems of desktop computers available. Computers these days have 64MB or 128MB of RAM space available for CPU operations. Considering the huge demands placed by computer users on the application programs, this space is not sufficient. Also users expect all these programs to run simultaneously which is not possible with the available space. Hence the need for virtual memory.

What is Virtual Memory?
Virtual memory is a technique which tricks an application program into believing that it has a contiguous address space and unlimited working memory. While the fact is the memory may be physically fragmented or extended on to disk storage. Systems that use virtual memory are capable of executing large applications at a fast rate and use real physical memory more efficiently than those without virtual memory. Virtual memory is different from the concept of memory visualization.

Working of a Virtual Memory
Virtual memory is an intelligent method of utilizing the computer's actual memory capacity and manipulating it using a combination of the operating system and memory hardware capabilities. It acts as a temporary storage medium in which data is stored in a file format. Since the operating system acts as the determinant, it provides quick access to the data and allows smoother operating capacity. Virtual memory works with co-ordination with RAM by storing and presenting data quickly to serve the requirements of an application program. Secondary storage device like hard disk has a large storage capacity but it provides a very slow access to the data.

How Virtual Memory is Organized?
Virtual memory is organized by either paging or segmentation. Most of the systems use page tables to translate the virtual addresses seen by application programs into physical addresses used by the processor to execute instructions. Page table maintains entries for mapping a virtual address to physical address. Systems may have a single page table for the entire system or an individual page table for every application program. Thus paging can be defined as the process of moving inactive virtual memory pages to disk and restoring them to real memory upon request. There are various algorithms to select which pages should be moved to hard disk and which should be retained.

Very few systems use the concept of segmentation for implementing virtual memory. In segmentation memory is divided in variable size segments. Segment number and an offset within the segment together form a virtual address. If a processor wants a particular data item it first looks up for its segment number in a segment table to find a segment descriptor. Segment descriptor gives information whether the offset within the segment is less than the length of the segment and if it isn't an interrupt is generated to notify that the segment is found. If the processor is unable to find the segment in the main memory it generates a hardware interrupt prompting the operating system to swap in the segment. The operating system then searches for the segments that were not in use for a long time and swaps them out of main memory in order to make space for the new segments to be read in.

How to Increase Virtual Memory?
Here is a step by step instruction set to increase the virtual memory of your computer. (For Windows XP):
  • Click the menu start, then click control panel
  • Select performance and maintenance, under that click system
  • Click settings on the advanced tab under performance
  • On the advanced tab under virtual memory, click change
  • Under rrive [volume label], select the drive that contains the paging file that you wish to change
  • Under paging file size for selected drive, click on the check box, custom size
  • You can choose the amount of memory you wish to reserve for virtual memory by entering the initial and maximum size
  • Click set
  • Restart the computer when prompted
If you find your computer running slow then increasing virtual memory won't help, it might be just the result of ' thrashing'. Shuffling blocks of virtual memory between real memory and disks consumes most of computer's time, thus causing thrashing. Though well-designed application programs may help to solve this problem to a certain extent, the ultimate cure is to install more real memory.

No comments:

Post a Comment