Virtual Memory In A Computer System || club5050
![jtk.jpg](https://steemitimages.com/640x0/https://cdn.steemitimages.com/DQmPkjYufQUBV5JhsP4qCxzgwYjxcLN5CppCbiiQQZWMeFf/jtk.jpg)
Virtual memory in Computer system
Virtual memory is a type of memory which is virtually exists but physically not exists.
Why needed virtual memory?
We know there are mainly two types of memory in computer system. They are primary memory and secondary memory. RAM is a type of primary memory and when a process is executing then it is loaded on ram. As ram is a volatile memory, so that if power is off as soon as ram lost its whole data. So, if we have to run a program then firstly, we have to load it on the ram. But sometimes the size of the program is very much larger than the size of the ram. Then its impossible to load the program on the ram.
Idea of virtual memory
If we want to solve this problem by increasing ram size, then we have to made ram with infinite size. But that’s also impossible. Here comes the idea of virtual memory. On virtual memory system, CPU defines a portion of secondary memory as virtual memory. This secondary memory which is termed as virtual memory loads the whole program, and then we load the needed portion of the program to the ram. CPU asks for the needed page then operating system search it on cache memory then ram. If the required page is not found in ram, then it raises an error. Then operating system searches it on virtual memory and if found then bring it on ram and restart. Then as soon as CPU farther asks for the page, CPU found it in ram and implement it.
![9_01_VirtualMemoryLarger (1).jpg](https://steemitimages.com/640x0/https://cdn.steemitimages.com/DQmYwQQebGPhMVGdpVozAisK2dGLKduoFo2kFWWkFyYYpGA/9_01_VirtualMemoryLarger%20(1).jpg)
As a result of virtual memory, a program size doesn’t matter. Small ram size also doesn’t matter on this fact. Because it only does replacement of pages. We use paging and page replacement algorithm for replacing page.
Conclusion
As a result of using virtual memory, we are able to run a very big process on a computer which has a small ram. We can watch a very big size movie or can play a game which consume a large space and can use very large software. So, at last, we can say that virtual memory allows us to use the computer effectively and efficiently.
Source
- Fundamentals of Operating Systems