You are on page 1of 2

Virtual Memory

In an operating system, sometimes a program is very large to be loaded into the main memory.
When a computer is running, many programs simultaneously share the CPU. Each running
program and the data structures need to manage it, which is called a process. Each process is
allocated an address space. Process is a set of valid addresses that can be used. This address
space can be changed dynamically. If a process tries to access the address that is not part of its
address space, an error occurs and the operating system takes over by killing the process. Thus
some mechanism is needed that allows the execution of a process which is not completely in
main memory. The programmers have to deal with swapping in and out to make sure that at any
moment the instruction to be executed next is physically in main memory. So, this brings a heavy
burden on the programmers. The solution called virtual memory, which has been adopted by
almost all modern operating systems.
Virtual memory is a technology in which some space in hard disk is used as an extension of main
memory so that a user program need not worry if its size extends the size of main memory. If this
happens only a part of the program will be in main memory and other parts will remain on hard
Using virtual memory, if a process which is needed is not in main memory, then different piece
will be swapped and the first one will be brought in. Unfortunately, if the latter one is used
immediately, then it will have to be loaded back into main memory. The access to hard disk is
time-consuming compared to main memory access, so the reference to the virtual memory space
on hard disks will make the system performance low significantly. Instruction and data
references tend to be bounded to one piece of process. So access to hard disks will not be

frequently requested and performed. The same principle enables the caching mechanism to
increase system performance and also avoids the deterioration of performance with virtual
memory. Paging or/and segmentation are two methods that are usually used to separate the hard
disks and main memory.

The main problem with virtual memory is the page fault. A page fault happen to occur when a
program requests an address on a page which is not in the present set of memory resident pages.
The operating system must handle page faults by making the accessed data memory resident
allowing the program to continue the process as if page fault never occurred. The main drawback
of page fault when a virtual memory is not resident is that allocation of memory is potentially

(n.d.). Retrieved from
(n.d.). Retrieved from
(n.d.). Retrieved from