A brief Intro of virtualization and vmware esxi
At the starting point computer hardware was designed to run a single operating system and a single application as shown in Figure 1, leaving most machines vastly underutilized.
Figure 1: A physical machine
The solution to the above problem is virtualization. Virtualization is a technique which allows one to partition a computer system into multiple completely separate systems as shown in Figure 2. Each of these provides a software environment which is very similar to that of a complete computer. Such an environment is called a virtual machine. By decoupling the physical hardware from the operating system, virtualization provides more operational flexibility and increases the utilization rate of the underlying physical hardware. Years ago, a problem aroused. How to run multiple operating systems on the same machine at the same time? The solution to this problem was virtual machines. In a virtualization environment, a single physical computer runs software that abstracts the physical computers resources so that they may be shared between multiple virtual machines. Each virtual machine may be running an operating system different from all of the other virtual machines on the physical machine. The usual goal of virtualization is to centralize administrative tasks while improving scalability and overall hardware-resource utilization.
Figure 2: Virtualization Architecture
One will typically want to install an operating system on a virtual machine to be able to run applications. This guest operating system assumes that it has complete control of the computer, and it will attempt to access its hardware. This cannot be allowed, since the hardware is shared with guest operating systems running on other virtual machines. A program called VMM or hypervisor is needed to make sure all resources are shared properly. The advantages of using VM are compatibility, isolation, hardware independence and encapsulation.
Virtualization is mainly used in server consolidation .It is an approach for the efficient usage of computer server resources in order to reduce the total number of servers or server locations that an organization requires. One can use virtual machines to run multiple isolated virtual servers on a single physical server. This allows hardware to be used more efficiently and decreases hardware costs. For an internet hosting company this can be used to allow customers full access to a virtual server without endangering other servers on the same physical machine. Server virtualization is also used for software infrastructure of cloud computing services which provide computing resources over the internet. By using a virtual machine cloud service customer creates computing resources quickly on the cloud computing infrastructure. Some other uses of virtualization are in software development, running untrusted software etc.
Some disadvantages of using virtualization includes the following
1) If the physical hardware of which virtual machines are hosted is crashed it will be drastic condition.
2) A virtual machine is less efficient than a real machine when it accesses the hardware indirectly.
VIRTUAL MACHINE MONITOR
Virtual Machine Monitor also called hypervisor sits between one or more operating systems and the hardware and gives the illusion to each running operating system that it controls the machine. Behind the scenes, however, the monitor actually is in control of the hardware, and must multiplex running operating systems across the physical resources of the machine. Indeed, the VMM serves as an operating system for operating systems, but at a much lower level; the operating system must still think it is interacting with the physical hardware. Thus, transparency is a major goal of VMMs.
There are two types of hypervisors given below :
● Type 1 (or native, bare metal) hypervisors run directly on the host’s hardware to control the hardware and to manage guest operating systems. A guest operating system thus runs on another level above the hypervisor.
● Type 2 (or hosted) hypervisors run within a conventional operating system environment. With the hypervisor layer as a distinct second software level, guest operating systems run at the third level above the hardware.
Type 1 and Type 2 hypervisors are shown in Figure 3.
Figure 3: Types of Virtual Machine Monitors
Since Type 1 hypervisors has direct access to the hardware resources rather than going through an operating system, it is more efficient than Type 2 (hosted) architecture and delivers greater scalability, robustness and performance.
VMware ESXi is fully virtualized, Type 1 VMM. The architecture of VMware ESXi is shown in Figure 4.
Figure 4: VMware ESXi Architecture
The VMware ESXi architecture comprises the underlying operating system, called VMkernel, and processes that run on top of it. VMkernel is a POSIX-like operating system which provides means for running all processes on the system, including management applications and agents as well as virtual machines. It has control of all hardware devices on the server and provides certain functionality similar to that found in other operating systems, such as process creation and control, signals, file system, and process threads. It is designed specifically to support running multiple virtual machines and provides such core functionality as Resource scheduling, I/O stacks, Device drivers.
Virtualization is done using a combination of binary translation and direct execution techniques. The kernel code is translated to replace non virtualizable instructions with new sequences of instructions that have the intended effect on the virtual hardware. Meanwhile, user level code is directly executed on the processor for high performance virtualization.
From the view of the application running inside the virtual machine, the hypervisor adds an extra level of address translation that maps the guest physical address to the host physical address. In ESXi, the address translation between guest physical memory and host physical memory is maintained by the hypervisor using a physical memory mapping data structure, for each virtual machine. The hypervisor is responsible for mapping guest physical memory to the host physical memory, and it uses shadow page tables to accelerate the mappings.
Device and I/O Virtualization
VMware ESX implements a streamlined path to provide high-speed I/O for the performance critical devices: network and disk. An I/O request issued by the guest OS first goes to the driver in the virtual machine. The driver typically turns the I/O requests into accesses to I/O ports to communicate to the virtual devices using privileged x86/x86-64 IN and OUT instructions. These instructions are trapped by the VMM, and then handled by device emulation code in the VMM based on the specific I/O port being accessed. The VMM then calls device independent network or disk code to process the I/O. For disk I/O, ESX maintains a queue of pending requests per virtual machine for each target SCSI device. The I/O requests are then sent down to the device driver loaded into ESX for the specific physical device.