Virtual Memory | Benefits of having Virtual Memory | Disadvantages of having Virtual Memory

Virtual Memory:
1. In the most of the computer system, the physical main memory is not as large as address space of the processor.
2. Suppose user tries to run a program.
3. If the program run by the user does not completely fit into the main memory then the parts of its currently being executed are stored in main memory and remaining portion is stored in secondary storage device such as HDD.
4. When a new part of program is to be brought into main memory for execution and if the memory is full, it must replace another part which is already is in main memory.
5. As this secondary memory is not actually part of system memory, so for CPU, secondary memory is considered as Virtual Memory. 6. Virtual Memory was introduced in the system in order to increase the size the size of memory.
7. Virtual memory is a memory management technique that is implemented using both hardware and software.
8. It maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory.

Benefits of having Virtual Memory:
1. Large programs can be written, as virtual space available is huge compared to physical memory.
2. Less I/O required, leads to faster and easy swapping of processes.
3. More physical memory available, as programs are stored on virtual memory, so they occupy very less space on actual physical memory.

1. Applications run slower if the system is using virtual memory.
2. It takes more time to switch between applications.
3. Less hard drive space for your use.
4. It reduces system stability.