×

Virtual Memory in Operating System

What is Virtual Memory

Virtual Memory is a storage scheme in which the users have an illusion that users have a significant amount of Main Memory. We can perform this by taking a section of Secondary storage as the Main Memory.

With the help of virtual memory, we can load or store the large size processes than the available memory.

In other words, Virtual Memory is defined as an area in which the programs of large size are able to store themselves in the form of pages.

 Virtual Memory is helpful in the scenario where the users have a small amount of physical memory. With the help of demand paging and demand segmentation, virtual memory is implemented.

How Virtual Memory Works

In today’s scenario, the concept of Virtual Memory is quite common. Virtual Memory is used when pages need to be loaded in the Main memory, but there is no availability of memory for the pages.

So, in this situation, instead of avoiding pages to enter into the Main Memory, the operating system finds the space for RAM (Random Access Memory) which are slightest used in the current time or, which are not referenced into the secondary storage for the purpose of creating the space for the new pages into the Main memory.

Because all this mechanism is done automatically, so this makes the computer with a more amount of RAM (Random Access Memory).

Benefits of Virtual Memory

The benefits of virtual memory are:

  1. With the help of Virtual Memory, we can execute the number of processes at once.
  2. It is helpful to fit the various programs into a smaller program.
  3. With the help of Virtual Memory, we can run multiple applications at a time.
  4. In this, a similar code or data can be shared with the memory.
  5. Code or data must be read from the disk when needed.
  6. Virtual Memory is useful in the implementation of a multiprogramming environment.
  7. The processes are kept in the main memory. Due to this, the CPU is used effectively.
  8. In Virtual Memory, the user is able to run a large-size application in the less RAM.
  9. In Virtual Memory, no requirement to purchase or buy more RAMs memory.
  10. We can place the code anywhere in the physical memory without any need for relocation.

Drawbacks of Virtual Memory

The drawbacks of virtual memory are:

  1. Virtual Memory can reduce system stability.
  2. Virtual memory does not provide the same performance as RAM.
  3. When the system use virtual memory, then the application may run slower.
  4. To switch between the applications, Virtual Memory requires more time.
  5. If we use Virtual Memory, then we don’t have more hard disk space for its use.

Snapshot of a Virtual Memory Management System

What is Virtual Memory

Suppose we have two processes, which are process P1 and the process P2. Process P1 and P2 comprises of four pages. Each page size is 1 KB. There are eight frames that are present in the Main Memory, and the size of each frame is 1 KB. The operating system is residing in the first 2 partitions. The first page of the process P1 is stored in the third partition. In the memory, the other frames are also occupied with the different process pages.

The size of each page table is 1KB. So, we can fit each of these in one frame. We can see in the above diagram; the page table consists of several types of information.

There is a register contained in the CPU that includes the base address of the page table. The base address of the process P1 is 5, and the base address of the process P2 is 7. To access the actual corresponding entry, the base address of the page table is added to the page number of the logical address.


Related Topics

MS-DOS Operating System

It is also referred to occasionally as "DOS", an abbreviation for disc operating systems. Operating systems with a graphical user interface (GUI) in different iterations of the graphical Microsoft Windows...

5 minutes read.

N-Step-SCAN Disk Scheduling

Before you study about N-Step-SCAN Disk Scheduling, it requires prerequisite of what is Disk Scheduling Algorithms: Operating systems use disc scheduling to schedule I/O requests that arrive at the disc....

4 minutes read.

Difference between SCAN and FCFS Disk Scheduling Algorithm

SCAN / Elevator Algorithm A different form of disc scheduling method is the SCAN disc scheduling algorithm. We move the disc arm in a certain direction in this process (the direction...

3 minutes read.

Unix Operating System

Unix Operating System Unix Operating System is a multiuser, portable, time-sharing, and multitasking operating system that was developed in 1969. Unix operating system was developed by a group of AT &...

3 minutes read.

Distributed Shared Memory

Distributed Shared Memory is a process of managing memory over more than one node and makes inter-process communication which transfers to end users. It is a mechanism that allows user...

2 minutes read.

Interested Variable Mechanism

Interested Variable Mechanism It is a must to provide progress to the process synchronization mechanism. In variable mechanism, if there is a process that doesn’t need to enter into the critical section, then due...

5 minutes read.

Difference between SSTF and LOOK Disk Scheduling Algorithm

Shortest Seek Time First / SSTF Shortest Seek Time First (SSTF) is an acronym for "shortest seek time first." The task request that is closest to the present position of the...

4 minutes read.

Evolution of Operating System

Evolution of Operating System The evolution of various types of operating systems can be briefly described as follows: Serial Processing Since 1950, the operating system started to be in use. Before 1950, there...

5 minutes read.

Fixed Partitioning in Operating System

Fixed Partitioning in OS Fixed Partitioning is also known as Contiguous memory allocation. Fixed Partitioning is the easiest method, which is used to load more than one process into the main memory. In Fixed...

5 minutes read.

Components of Operating System

Components of Operating System: An operating system is a complex and vast system. We can only create the operating system by dividing it into small parts. Each part must be...

5 minutes read.

What is Scheduling on OS

Scheduling is the process which is used to share the computing resources such as memory, processor time, and bandwidth to the different processes, data flows, threads, and applications which need them. Scheduling is...

5 minutes read.

FCFS Scheduling in OS

FCFS: First Come First Serve Scheduling in OS FCFS is a non-preemptive and preemptive scheduling algorithm that is easy to understand and use. In this, the process which reaches first is...

3 minutes read.

Virtual Memory in Operating System

What is Virtual Memory Virtual Memory is a storage scheme in which the users have an illusion that users have a significant amount of Main Memory. We can perform this by taking a...

3 minutes read.

Android Operating System

What is Android Operating System? Android is a Linux-based and open-source operating system mainly established for mobile devices like tablet computers and Smartphones. The Android operating system was established by the...

5 minutes read.

Difference between Rotational Latency and Disk Assess Time in Disk Scheduling

Disk scheduling is used by operating systems to arrange the arrival of I/O requests to the disc. Disk scheduling is necessary because several I/O requests may occur from various processes,...

4 minutes read.

Paging and Segmentation in OS

What is Paging in OS? Paging is a storage technique used for memory management. In paging, the (OS) Operating System retrieves the processes from the secondary memory into the main memory,...

6 minutes read.

Thrashing in Operating System

A virtual memory system's poor performance when the same pages are loaded repeatedly due to a lack of main memory to store them in secondary memory is referred to as...

3 minutes read.

Dining Philosophers Problem in Operating System

Edsger Wybe Dijkstra was a well-known Dutch scientist. He was the first person ever to present the Dining Philosophers Problem in the stream of Computer Science. The dining philosophers problem...

5 minutes read.

Test Set Lock Mechanism | Operating System

Modification in the Assembly Code The problem in the lock variable is that, in some cases, the process reads the previous or old value of the lock variable and enters into the critical...

4 minutes read.

Deadlock Detection and Recovery

Deadlock Detection and Recovery In deadlock detection and recovery, to avoid or prevent a deadlock, the operating system uses various methods. For checking deadlock, an operating system continuously monitors the system. Then also,...

2 minutes read.