Hypervisor, Virtual-Memory & Swap-space

EVER HAVE THAT FEELING WHERE YOU’RE NOT SURE IF YOU’RE AWAKE OR DREAMING?

Virtual memory (VM): is a combo of RAM & Disk-Space, like a piece of paper that helps you memorize stuff when your short-term memory can’t hold so much information at once. in computer hardware, the same principle is applied. and mapping from a virtual -address to the physical-address is handled by memory-management-unit (MMU) which is managed by the operating system (OS) through the use of page tables or a process called “Paging

As you can see the physical address is not at the same place as the virtual address, and memory in the virtual-address is paged-in when needed then paged-out, just like a notebook or piece of paper you take look then you put it back in.

Swap-space (SwS): is a space on the hard-disk which or a portion of virtual memory located on the hard disk, used when RAM is full. and this is useful when you are running a lot of applications that are not used or are used less. but keep in mind that SwS it’s slower than RAM because every time the OS is translating from logical to physical, it requires a lookup in the page table, which is stored in RAM. meaning every process request would require two physical memory accesses and this reduces the overall performance.

Hypervisor: is a piece of software that is running on top of the hardware. the hypervisor is simply turning the virtual memory mechanism into a virtualization mechanism that involves adding another level of indirection. A consumer application generates the next instruction with its target address. This target address is within the virtual machine in which the consumer application is executing. the virtual machine page table maps this target address to an address within the virtual machine based on the target address as before (or indicates that the page is not currently in memory). The address within the virtual machine is converted to a physical address by use of a page table within the hypervisor that manages the current virtual machines.

Summary

Virtual memory or virilization is a technique that enables us to map a large logical address space onto a smaller physical memory and allows us to run extremely large processes and to raise the degree of multiprogramming (allowing more processes to be available for execution at one time), increasing CPU utilization, overcoming the main memory limitation, and supporting VM through page tables.