Virtual Memory in Operating System
What is Virtual Memory in Operating System
Virtual Memory is a storage scheme that provides user an illusion of having a very big main memory. This is done by treating a part of secondary memory as the main memory. In this technique, User can load the bigger size processes than the available main memory by having the illusion that the memory is available to load the process.
Instead of loading one big process in the main memory, the Operating System loads the different parts of more than one process in the main memory. By doing this, the degree of multiprogramming will be increased and therefore, the CPU utilization will also be increased.
How Virtual Memory Works?
In the modern world, virtual memory has become quite common these days. It is used whenever some pages require to be loaded in the main memory for the execution, and the memory is not available for those many pages.
So, in that case, instead of preventing pages from entering in the main memory, the OS searches for the RAM space that are minimum used in the recent times or that are not referenced into the secondary memory to make the space for the new pages in the main memory.
Uses of Virtual Memory
Virtual memory also permits processes for sharing files easily and for implementing shared memory. Moreover, it offers a well-organized mechanism for process creation. Virtual memory is not that easy to apply and execute. However, this technique may substantially decrease performance if it is not utilized carefully.
Advantages of Virtual Memory
- The degree of Multiprogramming will be increased. Virtual Memory allows you to run more applications at a time.
- User can run large application with less real RAM.
- There is no need to buy more memory RAMs.
- With the help of virtual memory, you can easily fit many large programs into smaller programs.
- With the help of Virtual memory, a multiprogramming environment can be easily implemented.
- Data should be read from disk at the time when required.
- Common data can be shared easily between memory.
Disadvantages of Virtual Memory
- The system becomes slower since swapping takes time.
- It takes more time in switching between applications.
- The user will have the lesser hard disk space for its use.
- Virtual memory reduces the stability of the system.
- The performance of Virtual memory is not as good as that of RAM.
- If a system is using virtual memory then applications may run slower.
- Virtual memory negatively affects the overall performance of a system.