DEV Community

Cover image for ๐–๐ก๐š๐ญ ๐ข๐ฌ ๐š ๐•๐ข๐ซ๐ญ๐ฎ๐š๐ฅ ๐Œ๐š๐œ๐ก๐ข๐ง๐ž?
Megha Sharma
Megha Sharma

Posted on

๐–๐ก๐š๐ญ ๐ข๐ฌ ๐š ๐•๐ข๐ซ๐ญ๐ฎ๐š๐ฅ ๐Œ๐š๐œ๐ก๐ข๐ง๐ž?

A Virtual Machine (VM) is a software-based emulation of a physical computer, allowing multiple operating systems to run on a single physical host. Each VM operates as an independent and isolated instance with its own virtualized hardware components.

Virtual Machine is a system which acts exactly like a computer. VMs are like physical hardware turning one server into many servers. It uses technology called hypervisor which allows multiple VMs to run on a single machine. Each VM has a full copy of an operating system, the application, necessary binaries and libraries. VMs are bulky in nature.

What is a hypervisor?

Image description
A hypervisor, also known as a virtual machine monitor (VMM), is a software layer that enables the creation, management, and execution of virtual machines (VMs). It abstracts and allocates the underlying hardware resources of a host system to multiple VMs, allowing them to run concurrently while maintaining isolation from each other.

๐Ÿ‘‰ Types of Hypervisors:

Image description

Type 1 Hypervisor (Bare-Metal Hypervisor):

A Type 1 hypervisor, also known as a bare-metal or native hypervisor, runs directly on the host's hardware. It provides a highly efficient and secure virtualization platform, typically used in enterprise data centers and server-based environments. This type of hypervisor manages VMs without the need for an underlying operating system, offering direct access to hardware resources.

Examples: KVM, Microsoft Hyper-V, VMware vSphere, Proxmox, XenServer*.*

Type 2 Hypervisor (Hosted Hypervisor):

A Type 2 hypervisor, also known as a hosted hypervisor, runs on top of an existing operating system (OS). It functions as an application within the host OS, which manages the hardware calls on behalf of the hypervisor. This type of hypervisor is typically used for desktop virtualization and testing environments.

Examples: VMware Workstation, Oracle VirtualBox, Parallels Desktop

๐–๐ก๐š๐ญ ๐š๐ซ๐ž ๐‚๐จ๐ง๐ญ๐š๐ข๐ง๐ž๐ซ๐ฌ?

Image description
Containers are packages of software that contain all of the necessary elements to run in any environment. In this way, containers virtualize the operating system and run anywhere, from a private data center to the public cloud or even on a developerโ€™s personal laptop. Containerization allows our development teams to move fast, deploy software efficiently, and operate at an unprecedented scale.

Containers are lightweight, portable, and self-contained executable images that contain software applications and their dependencies. They are used to deploy and run applications in a consistent way across different environments, such as development, staging, and production. Containers are typically deployed from an image by using an orchestration platform, like Kubernetes. These platforms provide a way to manage and deploy containers at scale.

D๐ข๐Ÿ๐Ÿ๐ž๐ซ๐ž๐ง๐œ๐ž๐ฌ ๐›๐ž๐ญ๐ฐ๐ž๐ž๐ง ๐‚๐จ๐ง๐ญ๐š๐ข๐ง๐ž๐ซ๐ฌ ๐š๐ง๐ ๐•๐Œ๐ฌ.

Image description

โ€ข ๐Ž๐’ ๐š๐ง๐ ๐€๐ซ๐œ๐ก๐ข๐ญ๐ž๐œ๐ญ๐ฎ๐ซ๐ž: Virtual machines have a host OS and the guest OS inside each VM. Guest OS can be any OS, like Linux or Windows, irrespective of host OS. While Docker containers host on a single physical server with a host OS, which shares among them. As it shares the host OS between containers it makes them light and increases the boot time.

โ€ข ๐๐จ๐ซ๐ญ๐š๐›๐ข๐ฅ๐ข๐ญ๐ฒ: Virtual machines are isolated from their OS, and so, they cannot be ported across multiple platforms. Docker containers can be easily ported across different platforms as they are self-contained and can run applications in any environment, and since they donโ€™t need a guest OS.

โ€ข ๐๐ž๐ซ๐Ÿ๐จ๐ซ๐ฆ๐š๐ง๐œ๐ž: Virtual machines are more bulkier than Docker containers as the virtual machines need to load the entire OS to start. The lightweight architecture of Docker containers are light weight as they donโ€™t have a guest OS.

โ€ข ๐•๐ข๐ซ๐ญ๐ฎ๐š๐ฅ๐ข๐ณ๐š๐ญ๐ข๐จ๐ง: Virtual Machine use Hardware level virtualization and Containers use OS level virtualization.

โ€ข Cost: One of the biggest advantages of Containers is that they are much cheaper to use than Virtual Machines. A single Container can use much less CPU and memory than a Virtual Machine, which makes them a more cost-effective option for applications that need to run on a limited number of resources.

โ€ข Size: Containers are also smaller in size than Virtual Machines. This is because a Container doesnโ€™t include the entire operating system, just the application and its dependencies. This makes them a better option for applications that need to run on a limited number of resources.

โ€ข Ease of Use: Containers are much easier to use than Virtual Machines. This is because Containers are packaged as a single unit, while Virtual Machines require a lot of configuration and tuning.

Top comments (2)

Collapse
 
kiran_baliga profile image
Kiran Baliga

Thanks for the article!

Collapse
 
meghasharmaaaa profile image
Megha Sharma

Thank you so much for your feedback, Kiran! I'm glad you found the article helpful.