What is Virtual Memory was the first question my mom asked me on the phone when she called me first time since our last chat that didn’t end well some four weeks ago.
In silence for a minute or so I started to wonder how on earth did my mother suddenly decided to bother herself with What virtual memory was in the first place? So after a minute of chit chatting, I came to understand that a computer technician who also happens to be a sales manager for a technology company had been to see her regarding her aging laptop.
And there I was, just about to lecture my mother, what virtual memory was all about and how it can be of help to her.
So, What Is Virtual Memory
I like Margaret Rouse‘s analogy, which delves into the most intricate, but here I was speaking to my mom ?
Computers have a finite amount of RAM so memory can run out, especially when multiple programs run at the same time. A system using virtual memory can load larger programs or multiple programs running at the same time, allowing each one to operate as if it has infinite memory and without having to purchase more RAM.
As part of the process of copying virtual memory into physical memory, the OS divides memory into pagefiles or swap files that contain a fixed number of addresses. Each page is stored on a disk and when the page is needed, the OS copies it from the disk to main memory and translates the virtual addresses into real addresses.
Pros and cons of using virtual memory
Among the primary benefits of virtual memory is its ability to handle twice as many addresses as main memory. It uses software to consume more memory by using the HDD as temporary storage while memory management units translate virtual memory addresses to physical addresses via the central processing unit. Programs use virtual addresses to store instructions and data; when a program is executed, the virtual addresses are converted into actual memory addresses.
Understanding The Memory Hierarchy