Virtual memory is a good concept currently used by modern operating systems. But I was stuck answering a question and was not sure enough about it. Here is the question:
Suppose there are only a few applications running on a machine, such that the physical memory of system is more than the memory required by all the applications. To support virtual memory, the OS needs to do a lot work. So if the running applications all fit in the physical memory, is virtual memory really needed?
(Furthermore, the applications running together will always fit in RAM.)
A phone with 8GB RAM will be more efficient and fast than a device with 6GB RAM + 4GB of virtual RAM. The primary purpose of having virtual RAM is to make memory management better. With apps and games increasing in size, having virtual RAM will help your phone to keep more apps open on the RAM.
Using virtual memory makes a computer run slower, as the processor has to wait while data is swapped between hard disk and RAM. As secondary storage devices have slower access times than RAM, the computer's processing performance can be severely impaired.
Therefore, no matter how large the capacity of RAM is, it's still necessary for us to enable the virtual memory. Another thing about virtual memory is that Windows only uses paging files when it's necessary. In other words, Windows does not use paging files all the time.
- Switching between apps will most likely take a longer time. - Virtual memory reduces the amount of hard disk space available for your usage. - It has a negative impact on system stability. - It enables bigger programs to operate on systems that do not have enough physical RAM to execute them on their own.
Even when the memory usage of all applications fits in physical memory, virtual memory is still useful. VM can provide these features:
main()
at address 0x0800 0000)While not strictly needed in this scenario, virtual memory is about more than just providing "more" memory than is physically available (swapping). For example, it helps avoiding memory fragmentation (from an application point of view) and depending on how dynamic/shared libraries are implemented, it can help to avoid relocation (relocation is when the dynamic linker needs to adapt pointers in a library or executable that was just loaded).
A few more points to consider:
Virtual memory reduces severity of these bugs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With