Skip to main content

Virtual Memory In Operating System

We have discussed before various memory management strategies used in computer system. All these memory manage management strategies have the same goal:- to keep many processes in memory simultaneously to allow multiprogramming. Here we will read overall concept of Virtual Memory.

Virtual Memory is a storage allocation scheme in which secondary memory can be considered as the part of main memory. The size of virtual storage is limited by the addressing scheme of the computer system and amount of secondary memory is available. Virtual memory is implemented using both hardware and software. It maps memory addresses, called virtual addresses into physical addresses in computer memory. 

 Virtual memory is a technique that allows the execution of process that are not completely loaded in memory. One major advantage of this scheme is that programs can be of larger than physical memory. This technique frees the programmers from the concerns of memory-storage limitations. Virtual memory also allows processes to share files easily and to implement shared memory. In addition, it provides an efficient mechanism for process creation. Virtual memory is not easy to implement. It may decrease the performance if it is used carelessly. 

 In other words A computer can address more memory than the amount physically installed on the system. This extra memory is actually called virtual memory and it is a section of a hard disk. It allows execution of a process  without the need to load the process in main memory completly.The process can execute even if it is loaded in main memory partially. The conventional memory management scheme suffer from two main limitations :-
  i> The O/S can not load a process until sufficient free memory for loading the entire process becomes available. This may delay as process's turnaround time.
ii> The O/S can not load process in a system whose main memory size is less than the total memory required by the process.

Virtual memory mechanism uses the following three basic concepts for its realization :- 

1. The On-Line Secondary storage device having much larger capacity than main memory.

2. Swapping is the process of transferring a block of data from secondary storage device to main memory and vice-versa. When the O/S transfers data from secondary storage to main memory, it is called swapping-in of data and opposite is calkled swapping-out of data.

3. In virtual memory system, the O/S partitions all process into pages,which recides on secondary memory storage. The O/S partitions the physical memory (RAM) into page frames of same size. Now instead of loading whole process in RAM, it swap only that page of process which is demanded by processor. This process is known as Demand paging.


 

In mechanism of virtual memory O/S manages memories in such a way that user feel that they have access to a single, large, and fast main memory. This is done by treating a part of secondary memory as the main memory. In this scheme, 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.


In modern word, virtual memory has become quite common these days. In this scheme, whenever some pages needs to be loaded in the main memory for the execution and the memory is not available for those many pages, then in that case, instead of stopping the pages from entering in the main memory, the O/S search for the RAM area that are least used in the recent times or that are not referenced and copy that into the secondary memory to make the space for the new pages in the main memory. Since all this procedure happens automatically, therefore it makes the computer feel like it is having the unlimited RAM.


ADVANTAGES :-
 i> More processes can be maintained in the main memory.
ii> The degree of Multiprogramming will be increased.
iii> There is no need to buy more memory RAMs.
iv> A process may be larger than all of main memory. 


DISADVANTAGES :-
   i> Difficult to implement. 
 ii> The system becomes slower since swapping takes time.
 ii> It takes more time in switching between applications.
iii> The user will have the lesser hard disk space for its use.
v> It may decrease performance rather than increase unless used carefully. 

Share, Follow and please comment if you find anything incorrect or to share more information about the topic discussed above.

Comments

Popular posts from this blog

Process Scheduling And Types of Process Schedular :-

        ⇰ PROCESS SCHEDULING Process Scheduling  is a task  of Operating System that schedules processes of different states like new, ready, waiting, terminated  and running.This scheduling helps in allocation of CPU time for each process, and Operating System allocates the CPU time for each procss. And the process scheduling plays important role to keep the CPU busy all the time.  ⏩   Followings are some objectives of Process Scheduling :-  i > To increase the amount of users within acceptable response times.  ii > To maintain the balance between response and utilization of system. iii > To decrease the enforce priorities and  give reference to the processes holding the key resources.      ⇰  PROCESS SCHEDULAR A scheduler carries out the pro cess scheduling work. Schedulers are often implemented so they keep all computer resources busy and  allows multiple users to shar...

Process & Its state And process control block :-

                ⇰  PROCESS :- A process can be thought of as a program in execution. Means when any program is executed it becomes process. A processwill need certain resources such as CPU time , memory, files and I/O devices to complete its task. These resources are allocated to the process either when it is created or at the time of execution.             A process is the unit of work in most systems. A system consistes of a collection of processes. All these processes may execute concurrently. Traditionally a process contained only a single thread. Most modern operating ststems now supports processes that have multiple threads.         The operating system is responsible for several important works of process management as - the creation and deletion of process, the schrduling of process, communication and deadlock handling of process. Process is broudly divided into two ...

Tokens and its types in 'C'

   Tokens are the smallest individual unit of a program or in simple words it is a main part of C program.Tokens are the building blocks of any program. The smallest individual and basic unit of a C programming is called c tokens.      *    Normally there are six types of tokens in C:- i> Keywords:-          Keywords are special words that are used to give a special meaning to the program and can't be used as variable and constant.They are basically a sequence of characters that have fixed to mean. For example:-                 auto     double      long     break                 float    short        char     if                while    continue   int       void etc. All...