This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
Virtual memory is a process in which data can be exchanged rapidly between the physical memory storage location and Random Access Memory (RAM). The main use of virtual memory is that it allows the use of larger programs and provides services to run those programs faster. In certain operating system such as windows XP, Vista etc., information or data can be constantly exchanged between the hard disk and Random Access Memory through Virtual memory. The exchange of data or information through virtual memory is known as swapping. It appears that the computer is having high RAM capacity when virtual memory is used. The reason is that the virtual memory allows the emulation of the transfer of whole block of data, hence enabling program to run smoothly and efficiently.
It is sometimes hard to put data into limited volatile RAM memory, and so data is usually written onto the hard disk. Actually, the size of the virtual memory is limited as to the size of the hard disk or to the space allocated on the hard disk for virtual memory to reside. When information is needed by RAM (physical memory), the system rapidly swaps the block of memory which lies between the RAM and the hard disk. Unlike the old time virtual memory, the present day virtual memory replaces fragmentation of programs.
Looking at the other side, virtual memory is a specialized secondary data storage, in which a small portion of the hard disk is dedicated for the storage of specialized virtual memory file. These virtual memory files are known to be as pages. There is an area in the hard disk which is dedicated to storing data blocks which needs to be swapped through the virtual memory and that is known as the page file. Many operating system will already set some size for the page file in the hard disk. Even page files can also exist on multiple disk drives. Those who are using modern operating system can change the size of its virtual memory as they wish to meet specific performance requirements. The size of a virtual memory page can range from thousand bites to many megabytes.
Usage of Virtual Memory
The use of virtual memory allows an entire data block of data or program to reside in the virtual memory itself. In this only the main part of the code will be executed in the physical memory while others are in the virtual memory itself. The use of virtual memory allows the currently working operating system to run so many programs and thus by increasing the level of multi programming within the operating system.
Virtual memory integration can be accomplished through the process of demand paging. Demand paging is simpler in design and hence is common. In the process of demand paging in virtual memory, the transfer of data from disk to RAM does not process until the program calls for the page. There is anticipatory paging process used by operating system that attempts to read and execute data transfer which was actually required to be in the RAM. After the paging of the data, track the memory usage and constantly call data back and forth between hard disk and RAM.
Each page in the virtual memory have there on page states. And these page states are registered in page tables. The page state can be valid/ invalid or available/unavailable. If an attempt is made to access the invalid page, then a page fault statement is shown by the virtual memory manager. Mapping is the process in which the virtual memory address is translated into physical address. Virtual memory is a part many of the operating system, but not DOS.
Virtual memory has economic benefit as well in addition to increase the speed of execution and operational size of the program. Hard disk is less expensive when compared to RAM. Accordingly, the use of virtual memory allows design of high capacity computing system at low cost. Without virtual memory, you could not run a spreadsheet, word and database program at the same time unless you had enough memory to hold all of them at once, because you would constantly be running out of memory and having to shut down one program in order to open another program. The larger the virtual memory, the more swapping on the hard disk.
ADVANTAGES OF VIRTUAL MEMORY
Virtual memory management system allows for the execution of a process without loading those processes into main memory. When we have a virtual memory in use, we do not need to load the entire process into the expensive main memory. There are a lot of advantages for this virtual memory. Firstly, it makes separation of physical and logical memory. If virtual memory is available, then the programmer can have a large deal of virtual memory even there is no physical memory. The reason for this situation is the cost factor of the main memory. That is the main memory is very expensive when compared to the secondary memory. There is large address space available irrespective of the actual size of physical memory.
A process can run even on a system with less RAM than that required by any process. When a process is running without virtual memory then that would be so cost consuming for the machine. Where there is a virtual memory, the turnaround of process is reduced. The reason is that process can start even when there is not enough memory to load the entire process. The concept of virtual memory also makes the programmer free. There is no need for the programmer to worry about the physical memory size when virtual memory presence is there.
There are exception handling procedures in the program that are used in certain cases when an error occurs. With the mechanism of virtual memory, the parts of a program are loaded on demand and those that are not needed may not get loaded. And this may lead to faster execution, better throughput, and response times. Since virtual memory enables for the execution of a process even when no sufficient memory is available, it can be effectively used to accommodate sufficient number of programs in the main memory. This increases the degree of multiprogramming, resulting in increased CPU utilization and system throughput. If virtual memory is not used, processes will need to wait for long durations if there is not sufficient main memory. Virtual memory is a system that provides a virtual environment to applications that is independent of the computers physical resources. Each application has a 2GB private and unshared address space.
Applications know only the virtual address space, they have no direct access to physical memory. The system maps physical memory to this virtual address space according to both need and availability. Portions of an application will be in the original files, the page files, or RAM. This managed by the system and is transparent to applications. The system will attempt to keep as much of the recently accessed data and code in RAM as is possible. The remainder will born on disk.
The virtual memory system can function without a page file but efficiency will be impaired. Application code is not normally copied to the page file as it can be reloaded from the original files if needed. Only modified data will be paged to the page file. With no page file only program code can be paged, thus unbalancing the system and leading to performance degradation. Virtual memory is not a trivial concept like floating point or twoâ€™s complement. Again, virtual memory is a system by which the machines or operating system fools processes running on the machine into machine into thinking that they have a lot more memory to work with than the capacity of RAM would indicate. It does this by storing the most recently used items in RAM, and storing the lesser used items in the slower disk memory, and interchange data between the two whenever a disk access is made. In this way, memory appears to programs to be a full 32 bit address space, when it fact memory space is probably only a mere fraction of that.
To take advantage of spacial locality as well as hardware issues with disk mass storage, it is important to know that just as lines of data in cache would often be larger than one byte or four bytes lines of data in a virtual memory. These lines can be also known as pages. And the page is the quantum unit of transfer between cache and RAM. Pages in a virtual address space are contiguous.
The three main parts of a virtual memory includes
Main memory i.e., RAM ( random access memory)
Secondary memory i.e., disk
Firstly, the main memory system is where the more recently used pages are stored. Each page is stored into subdivisions of memory called frames. A frame size is the same as that of page size. In the main memory, RAM, it holds recently used pages of memory.
Secondly, the secondary storage i.e. disk, stores the pages that are not currently used. Whwn a page needs to be brought to memory, the appropriate page is found and transferred to main memory. Whenever a page that has been modified during its time in main memory, it is written to disk. Thirdly, the page table is what keeps track of where pages are, and what their properties are. The system updates the page table as changes in the state of the system warrant. It makes sense that there are as many entries in the page table as there are pages in our virtual address space.
Virtual memory is simply the operating system using some amount of disk space as if it were real memory. The virtual memory system can be function without a page file but efficiency will be impaired. Application code is not normally copied to the page file as it can be reloded from the original from the original files if needed.