×

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

HRRN Scheduling in OS

Highest Response Ratio Next (HRRN) Scheduling in OS Highest Response Ratio Next Scheduling is a Non-Preemptive Scheduling algorithm. This algorithm provides the benefits of the shortest job first scheduling algorithm and also removes...

6 minutes read.

Process Synchronization | Operating System

Process Synchronization Process Synchronization means managing the process in such a manner so that no two processes have access to share similar data and resources. We can use Process Synchronization in a Multi-Process System...

4 minutes read.

Inter Process Communication in Operating System

Inter-Process Communication or IPC refers to the methods and techniques that allow processes (programs or tasks) to communicate with each other within a computer system. This is typically done through...

3 minutes read.

File in Operating System

What is File in Operating System?  A file is defined as a collection of the interrelated information that is stored in the secondary memory or the non-volatile memory such as optical...

4 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.

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.

Resource Allocation Graph in Operating System

Resource Allocation Graph in OS We use the resource allocation graph for the pictographic representation of the state of a system. The resource allocation graph contains all the information related to the processes that...

5 minutes read.

Process Management in OS

A Program will not do anything unless a CPU executes its instructions. An executing program is called a process. The Process requires computer resources to complete its task. More than...

3 minutes read.

Deadlock Avoidance

Deadlock Avoidance In an operating system, for deadlock avoidance, we perform the following: We only grant the request of the resources if the resulting state of the system will not cause any deadlock in the...

3 minutes read.

Multitasking Operating Systems

An operating system is the fundamental piece of software that enables a computer system to function and execute a command as intended. The user interface, hardware, and every other piece...

7 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.

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

C-SCAN / Circular Elevator The circular SCAN (C-SCAN) scheduling method is a modified version of the SCAN disc scheduling technique that addresses the SCAN algorithm's inefficiency by more equitably serving requests....

3 minutes read.

Operating System Tutorial

What is an Operating System? An Operating System is a System Software that handles the resources of a computer such as computer hardware and software and offers frequent services to the...

7 minutes read.

Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs

A CPU-bound process is one that spends most of its time executing instructions on the processor. A process that is I/O-bound spends most of its time waiting for input and...

2 minutes read.

Round-Robin Scheduling Algorithm in OS

Round-Robin is a Preemptive Scheduling Algorithm and is the most commonly used algorithm in CPU Scheduling.In this, each Process is assigned with a fix time interval to execute, which is...

5 minutes read.

What is Deadlock in OS?

Deadlock in Operating System In an Operating System, a process uses various resources, and the resources are used in the following manner: Request the ResourceUse the ResourceRelease the Resource In the Operating System, Deadlock is a condition...

4 minutes read.

Real-time Operating System

In this essay, we will thoroughly understand the real-time operating system. Real-Time Operating System: What do you mean? For any task to be completed, a real-time operating system (RTOS), a special-purpose operating...

5 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.

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.

Partitioning Algorithms

Partitioning Algorithms There are various types of Partitioning Algorithm: First-Fit AlgorithmNext-Fit AlgorithmBest-Fit AlgorithmWorst-Fit AlgorithmQuick-Fit Algorithm 1. First-Fit Algorithm: - In the First-Fit Partitioning algorithm, first, the linked list is scan, and when it...

3 minutes read.