Virtual Address in Operating system

 So, the concept of virtual address must be clear by now. The point is that the main use of virtual address is that, we wanted to execute process with a large amount of size which are even greater than the size of the main memory in comparison. But if a process is of suppose 20Mb size and the main memory is of size 10Mb(just assume) so we cannot fit the whole process inside the main memory. Here comes the role of Virtual Memory, we don't have to store the entire process in the main memory rather we can just store a part of the process which is required  by the OS to execute at that moment in the main memory, means only necessary parts of the process or program will reside in the main memory and the other unwanted stuff won't remain in the Main Memory, bcz the main memory is very limited and should be used very selectively. 

The processes are divided into pages and these pages are stored in secondary memory which acts like the main memory the reason being whenever we need a page of any process in the main memory then we access it using the Secondary Memory. So we can say that virtual memory is a storage technique in which the Secondary Semory is used as Main Memory only.

Basically, the process of bringing desired pages into the main memory and removing the unwanted pages from the main memory is known as Swapping In and Swapping Out.

Inside a process only Logical address are there and these addresses are translated into Physical Address at the Run-Time by the MMU, so these pages can reside in the main memory in a non-contiguous manner and can be swapped in and out at any time.

Simply this whole process of using Virtual Addresses is implemented using the Demand Paging technique which is just as the name Illustrates, that is the Pages are brought into the main memory on the basis of the Demand if it is required then it will be brought to the main memory else not. 

But, when there are continuously lot's of swapping operations then this condition is known as Thrashing which results in a sudden decrease in the CPU Utilization and this happens often because of High Degree of Multiprogramming( the number of process inside the main memory) after a certain degree of multiprogramming the CPU Utilization suddenly drops and this is known as thrashing. 

A recovery method for thrashing is that we should allow more process to come inside the main memory and also free some of the processes so that System can recover from Thrashing.

Good Night!

Comments

Popular Posts