What is Virtual Memory ?


  • 1
    R

    Virtual Memory is a way of using hard drive to provide a memory for the computer . Elements of virtual memory are called pages. When a needed memory that is not in the real memory is requested a memory from virtual memory moves to real memory address. Computers have a finite amount of RAM so when many programs run at the same time memory can run out. Using virtual memory it can load larger programs at the same time and operate like it has infinite memory. However , using virtual memory can slow computers down because data must be mapped between real memory (physical ) and virtual memory which requires extra capabilities for address translations .


  • 0
    Z

    @ramint said in What is Virtual Memory ?:

    Virtual Memory is a way of using hard drive to provide a memory for the computer . Elements of virtual memory are called pages. When a needed memory that is not in the real memory is requested a memory from virtual memory moves to real memory address. Computers have a finite amount of RAM so when many programs run at the same time memory can run out. Using virtual memory it can load larger programs at the same time and operate like it has infinite memory. However , using virtual memory can slow computers down because data must be mapped between real memory (physical ) and virtual memory which requires extra capabilities for address translations .

    What you have described is mostly related to swapping? Virtual memory just provides a logical address space which does not have 1:1 mapping with physical memory. The mapping between virtual memory to physical memory is done through a few levels of page tables. This essentially means that the contiguous address space of an application (which comes from virtual memory ) does not have to be contiguous in physical memory. Different non-contiguous fragments of physical memory can be mapped to a contiguos virtual memory segment.


  • 0
    A

    The main concept behind virtual memory is to increase the degree of multiprogramming. A process actually thinks all of its code is loaded into RAM when its running. Let's say this is a huge process, then putting all the code in RAM will take up too much space. So you only load a tiny portion of this code in RAM and leave the rest on the hard disk, and load it as you need. For example, think of your typical Word application, there are a ton of features that you rarely use. Putting all the code for that process in RAM is wasting memory. You can utilize memory by having independent jobs loaded in RAM.

    CPU utilization is one of the main goals of the OS. A process typically runs and then waits for I/O. If you have multiple processes in RAM, you can run a "ready" process, when the one that was just executing goes into the "waiting" state for whatever reason.


  • 0
    S

    ,,,
    Virtual memory provides an illusion that larger programs can be executed in small amount of memory .The pages of the virtual address space are stored in the hard disk and if any process requested to execute a page the execution is done on the basis of demand paging i.e., when the RAM is full and a page is requested which is not present in the RAM then through demand paging a page gets aborted and the requested page gets inserted by using page replacement techniques and the entire process is done by the virtual memory manager.If it is a pure demand paging then any page requested directly from the disk
    In this way by using virtual memory concept we can run a large program on small amount of memory which is one of main goal in the memory management i.e., efficient utilization of memory


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.