Virtual Memory and its Concepts

An In-depth Look into Virtual Memory and its Benefits

by Ms. Parveen Kaur*,

- Published in Journal of Advances and Scholarly Researches in Allied Education, E-ISSN: 2230-7540

Volume 16, Issue No. 1, Jan 2019, Pages 58 - 60 (3)

Published by: Ignited Minds Journals


ABSTRACT

This paper will provide you brief description about virtual Memory, its benefits and uses. Virtual memory is the base of modern applications. In Virtual Memory the concept of demand paging is used. All programs require memory to run on computer. When we want to run more than 1 process at same time than operating system take the responsibility to ensure that there is enough memory for each and every process. In this paper I provide you full fledge information about virtual memory, its uses, when we need it and how it is used. All programs stored in permanent memory. When a program is executed it is first loaded in main memory i.e. RAM (Random Access memory) which is very expensive and that is why Computers have limited amount of RAM. Now days Virtual Memory is used in all modern applications because it help us to extend the main memory without increasing the size of RAM which is very expensive. We extend the main memory with the help of secondary memory. Virtual memory is useful in two ways. First, it extends the physical memory with the help of secondary memory. Second, it provides us memory protection, because each virtual address is translated to a physical address.

KEYWORD

virtual memory, demand paging, operating system, process, main memory, RAM, secondary memory, memory protection, physical address

I. INTRODUCTION

Virtual memory is a part of secondary memory that acts like main memory. If you want to run multiple applications at the same time than all applications must be loaded into main memory but it is not possible with small size RAM. At that time Virtual memory is used and balances the process. Virtual memory is a memory management technique. Virtual memory provides an illusion to programmers that they have very large main memory but in reality users have very small memory. In this when multiple processes are running at same time than computer looks for the part of processes or complete processes which are not used by the CPU or which are currently inactive and put it into the secondary memory that is known as virtual memory to free up the space on the RAM. When a part or full process is needed than it brings back to the RAM from the disk. This increase the CPU utilization and throughput. This is possible because at one point of time CPU can execute only one process. In this way we can run multiple processes at the same time with limited physical memory (RAM). But the disk runs much slower than RAM, when we have to run multiple or large applications it is best to have as much physical memory if possible because the more RAM a computer has the fast it will run. Virtual memory provides us a solution when we have limited RAM but if we use more virtual memory than performance of our computer is degraded. So to get fast response from your computer use as much RAM as you can use and use the concept of virtual memory when there is requirement because with the use of virtual memory both cost and performance is reduce.

2. IMPLEMENTATIONS OF VIRTUAL MEMORY: DEMAND PAGING

The concept of Virtual memory is implemented using the concept of demand paging. Loading the page into memory on demand of CPU is called demand paging. In demand paging the concept of swapping is used. In Swapping we can put process from main memory to secondary memory that is called swap out and we can bring back processes from secondary to main memory it is called swap in. In demand paging process is divided into various pages & every page is given a unique address. At a time all the pages of a process are not brought in the main memory only some of the pages related to the pages are brought in main memory because at one point of time a CPU don‘t need all the pages in the main memory for execution of program only some of the pages are needed, remaining pages can be brought on the demand of CPU. When CPU needs those pages which are not available in the main memory; it is called page fault. Page fault means the page referenced by the CPU is not available in the main memory and it is to be searched in the secondary memory .Whenever the page fault occur the time taken to service the page fault is called as page fault service time. In page fault service time when

In the above diagram we have 2 processes , process A and process B. Suppose Process A has 6 pages 0 To 5 and process B has 4 pages 6 to 9 but there are only 4 pages of process A and 3 Pages of Process B are in primary memory and other pages are in secondary memory whenever The other pages are required by the CPU they are Swapped in and out from the main memory to secondary memory according to the requirement. Let main memory (MM) access time = ‗M‘ Page fault service time = ‗S‘ Page fault rate = ‗P‘ Now the effective memory access time (EMAT) = P(S) + (1-P) (M) Main memory access time means time require to access the main memory. Page fault service time means time require to find page in secondary memory and bring that page in main memory. Page fault rate means how frequently the page fault occurs.

3. PAGE REPLACEMENT ALGORITHMS

When page fault occur then we have to search that paper in secondary memory and bring that page from secondary to main memory. But the problem is that main memory is already full? How can we put require page in main memory at that time page replacement algorithms are used. The pages are swapped in and out on according to these page replacement algorithms. There are no. of algorithms are available. Every algorithm has its own functionality and we have to select algorithm which best suits to our requirement. Page replacement algorithm can be global replacement algorithm page related to any process can be replaced. Global page replacement algorithms are more complex to implement. The commonly used algorithms are: 1. First in First out (FIFO): In first in first out a page which comes first in main memory is out first. It means pages are replaced according to their arrival. For example if there are 3 Frames in main memory and pages are P1, P2, P3, P4, P5, and P6. First of all P1 comes Then P2, P3 now p1 is removed and p4 is enter in main memory similarly p2 remove and p5 is enter and so on…. Problem in FIFO: Belody Anomaly: When we increase the no. of frames than no. of page fault also increased this problem is called belody anomaly. 2. Optimal Page Replacement Algorithm (OPT): In this algorithm we see the future; it means a page which comes late in near future is replaced first. It is the most efficient algorithm because it provides minimum page faults. 3. Least recently used algorithm (LRU): In this algorithm we see the past, it means a page which used least recently is replaced first.

4. THRASHING

In the initial degree of multiprogramming up to some instant of time (t), the CPU utilization is very high and system resources are utilized by 100%.If we further increase the degree of multiprogramming, CPU utilization will be fall down and system will spend more time in the page replacement and the time taken to complete the execution of the process will be increase. This is called thrashing. So when system spends more time in page replacement rather than execution of the process is called thrashing.

Causes of Thrashing:

There are basically 2 reasons of thrashing 1. High degree of multiprogramming 2. Lack of frames.

and instruct the long term scheduler (LTS) not to bring the process into the memory after the point of (t). 2. If the system is already in thrashing than instruct the medium term scheduler (MTS) to suspend some of the processes so that we can recover the system from thrashing.

Advantages of Virtual Memory:

1. The use of Virtual memory is easy and cheap 2. It allows demand paging. 3. It provide efficient swapping 4. It provide the facility to run more than 1 applications same time. 5. With virtual memory we can run large applications with less RAM.

Disadvantages of Virtual Memory:

1. More access time. 2. Because of large access time applications run slower. .3. Complexity is high. 4. It takes more time when need switching between processes. 5. Overhead of swapping.

CONCLUSION

The concept of Virtual Memory is very useful because it increases the utilization of memory and provides us the cheapest way to run multiple programs simultaneously with less RAM. But the more use of virtual memory slow down the performance of our computer because more time is taken to access secondary memory as compare to RAM. It is useful when we use it in small amount so its use in large applications in large amount may reduce the overall performance of applications.

REFERENCES:

1. Muhammad Abdullah Awais/ Memory Management: Challenges and Techniques for Traditional Memory Allocation Algorithms MS150200157, Virtual University of Pakistan (2016)\ ms150200157@vu.edu.pk. Memory‖ (PDF) \ University of Washington. 3. Dr. Vivek Chaplot \ BNPG college \‖Virtual Memory Benefits‖\\ Research Article \ Survey Paper \ Case Study \ Udaipur \Rajasthan (2016)‖. www.ijarcsms.com‖. 4. Sumit Sehgal \ Virtual Memory (Research Paper) (2003)\http://www.daneprairie.com. 5. Assistance Prof. Dr. Qasim Mohammed Hussein \Virtual Memory (PDF) \ Tikrit University (2015). 6. https://www.academia.edu. ―Memory management in computer‖. 7. http://www.researchgate.net. ―Virtual memory concepts‖.

Corresponding Author Ms. Parveen Kaur*

Assistant Professor in Computer Department, DAV College for women, Ferozepur Cantt, India

kambojparveen341@gmail.com