OS is designed to be the sole owner to manage hardware resources. Multitasking OS provides software abstraction of hardware devices and enables us to use the device in an isolated manner. VM acts the same as a physical computer that runs OS on it and lets it manage hardware resources like in a real computer. You can get IT Consulting Services by Stampa Solutions for Virtualized Services.
The very important thing is that we can detach the computing from the hardware. That means you can run an android or iOS on a Windows PC, like when you’re using VirtualBox.
What is Virtual Machine?
VM is hardware-independent software running computers. Transaction from resource-level multiplexing to VM level multiplexing is nonignorable. With system virtualization, the VMM owns the hardware. It can use it to provide you with virtual hardware. Memory management is an important part of computer systems in multitasking OS research areas.
OS basically divides the memory into chunks and gives them different tasks like processes and threats at the runtime. Hardware support like segmentation hardware, Memory management unit etc., for efficient implementation of segmentation and paging in memory. It is the most common phenomenon in modern processors. Memory management adds a layer of functionality and feasibility to the traditional Memory Management Unit.
Memory management in the virtualized environment is very difficult due to the challenges in memory management described above.
2.1) Hypervisor memory allocation model:-
Most modern operating systems manage physical memory by dividing it into fixed-size regions called pages. Virtualized solution for memory management for different machines acts the same as paging by OS. OS assign addresses orderly to every process, where address starts from zero.
To solve the problem of allocating physical memory to a virtual machine, the hypervisor allocates pseudo-physical memory in contiguous blocks for each virtual machine. When a process runs in a virtual machine, it shares its guest’s physical address with its host OS thanks to work done by its guest OS’s virtual memory subsystem.
There are some possibilities given below:-
- The easiest way to make sure every virtual machine has a set amount of memory is static allocation. This method is very simple but may not be the best choice for your situation. It may take a long time for them to use up their allocated memory, or they might need more and can’t get it because there isn’t enough.
- The better way is to use the memory allocation process. This process is just like when OS allocates memory to processes, depending on how much the process needs. If you are using dynamic allocation, then you have to keep track of guests-to-machine mapping in a dynamic way, which is just what I described above.
Dynamic memory is a technique that helps us remember things better. When we want to convert from the guest’s OS address to the physical address, we do it. For understanding, let’s take an example of where the guest OS allocates a page of memory for a process running on it. The guest’s physical page number will be mapped to the machine frame number. But that is not always true because the hypervisor can also invalidate GPFN and MFN maps and physical memory pages for other virtual machines.
The advantages of GPFN to MFN are given below:-
- Memory over-commitment is when your computer assigns more memory to the virtual machine than it has. This is possible because the virtual machine does not always use all the memory you give it. The hypervisor can swap out the guest’s OS memory pages to disk and then swap in new pages when there is a page fault.
- Deduplication is a way to get rid of the extra copies of data. For example, there are two GPFNs from different or the same virtual machines mapped on two MFNs. The identical data from one MFN is removed, and only one is left. This leaves more space in a virtual machine environment.
2.2) Virtualizing the Memory Management Unit:-
A hardware-assisted MMU is a component in a computer that handles memory. It has three major categories: hardware-assisted MMU, OS MMU and Application MMU. Virtualization indexing also means hardware-assisted MMU virtualization.
2.3) Software-based Memory Management Unit Virtualization (Shadow Paging):-
In software-based MMU virtualization, the hypervisor does most of the work. The hypervisor is in charge of protecting physical resources like the page table and base register. It also protects machine pages. The protection for CR3 is done a hardware protection mechanism that comes with the architecture.
Software-based MMU virtualization does not need any hardware support. Guest’s OS does not need any modification to run on a physical machine.
Memory can managed using both hardware and software. There are many levels for this type of management. The hypervisor caching method is very efficient. It will help you use your memory more effectively. You can also use tightly coupled memory page-level information sharing to collaborate with the other person’s memory.
We can use a symbiotic memory management approach to make sure that the guest’s operating system and the hypervisor both have enough memory. This is good because it will make it easier for people to use their computers. We can do this by making sure that we put in as much of our memory as possible into the guest’s operating system and also into the hypervisor. It is more likely that we will be able to do this if we first change existing memory management techniques, which some of them may not work anymore because of changes in core hardware.