Virtual memory is a method of using hard disk space to provide extra memory. It simulates additional main memory.
Virtual Memory
• Virtual memory is a method of using
hard disk space to provide extra memory. It simulates additional main memory.
• In Windows operating system, the
amount of virtual memory available equals the amount of free main memory plus
the amount of disk space allocated to the swap file.
• Fig. 4.9.1 shows logical view of
virtual memory concept.
• A swap file is an area of your hard
disk that is set aside for virtual memory. Swap files can be either temporary
or permanent.
•
Virtual memory is stored in the secondary storage device. It helps to extend
additional memory capacity and work with primary memory to load applications.
The virtual memory will reduce the cost of expanding the capacity of physical
memory. The implementations of virtual memory will different for operating
systems to operating system.
•
Each process address space is partitioned into parts that can be loaded into
primary memory when they are needed and written back to secondary storage otherwise. Address space partitions have been used for the code, data and
stack identified
by the compiler and relocating hardware. The portion of the process that is
actually in main memory at any time is defined to be the resident set of the
• The logical addressable space is
referred to as virtual memory. The virtual address space is much larger than
the physical primary memory in a computer system. The virtual memory works with
the help of secondary storage device and its speed is low compared to the
physical storage location.
•
Virtual memory uses two types of addresses Virtual address and physical
address.
•
Virtual address is referred by process and physical address is actual address
of the main memory.
• Whenever a process accesses a virtual
address, the system must translate it to a physical address. Virtual memory
system uses special purpose hardware. This hardware is called as memory
management unit.
•
Most virtual memory system use a technique called paging. The virtual address
space is divided into fixed size units called pages. The corresponding units in
the physical memory are called page frames. The pages and page frames are
normally the same size. The area on a hard disk that stores page frames is
usually called the paging file or the swap file.
Fig. 4.9.2 shows concept of virtual
memory.
•
When the system is ready to run a process, the system loads the process code
and Jerite data from secondary storage into primary memory. Only a small
portion of these on needs to be in primary memory at once for the process to
execute. The success of implementing virtual memory system is how to map
virtual addresses to physical addresses. Because processes reference only
virtual addresses.
•
Virtual
memory can be implement in one of two ways:
1. Paging
2. Segmentation
• Following are the situations, when
entire program is not required to load fully.
1. User written error handling routines
are used only when an error occurs in the data or computation.
2.
Certain options and features of a program may be used rarely.
3. Many tables are assigned a fixed
amount of address space even though only a small amount of the table is
actually used.
4.
Many routines are commonly used at mutually exclusive times during a run.
•
Virtual memory makes the task of programming much easier. Virtual memory is
bily commonly implemented by demand paging. Virtual memory mechanism bridges d
the size and speed gaps between the main memory and secondary storage and is
usually implemented in part by software technique.
Benefits
1.
Less I/O needed to load/swap a process.
2. Degree of multiprogramming can be
increased.
3. A program's logical address space can
be larger than physical memory.
Introduction to Operating Systems: Unit III: Memory Management : Tag: : Memory Management - Introduction to Operating Systems - Virtual Memory
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation