UPI Study › Courses › Introduction to Operating Systems › Free lessons › Lesson 10.3 Free with a free account
Types of Virtualization
Introduction to Operating Systems · Chapter 10: Virtualization and Virtual MachinesSection 10.3 · lesson 80 of 838 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Introduction to Operating Systems.
Lesson complete
Earn the 3 college credits for Introduction to Operating Systems
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: How Virtual Machines Replicate an OS →← The Benefits of VirtualizationNext lesson: How Virtual Machines Replicate an OS →
A free account plays all of Chapter 1 and 3 more lessons of Introduction to Operating Systems. Create a free account →
In this lesson
Type 1 and type 2 hypervisors, virtualization techniques, and containers.
- Distinguish type 1 bare-metal hypervisors from type 2 hosted hypervisors
- Compare full virtualization, paravirtualization, and hardware-assisted virtualization
- Explain how containers differ from virtual machines
- Choose between a virtual machine and a container for a given job
Free study notes
Get this lesson's notes by email
The key points and 4 practice questions with answers, in your inbox. One email, free.
One email. Unsubscribe in one click.
Transcript
Everything said in the video, section by section (1,047 words). Read along, or search it.
Opening Question
Not Every Virtual Machine Is the Same
Ivy, who looks after the computers at a school, runs virtual machines in two places: on the school's servers, and on her own laptop. The software underneath is built very differently in each. And Sam, who runs a small online bakery, has a small program that may not need a VM at all. Not every virtual machine is the same. Which kind fits which job? This lesson helps you decide.
Type 1
Bare-Metal Hypervisors on the Hardware
The first way to sort hypervisors is by where they sit. A type 1 hypervisor, also called bare-metal, runs directly on the physical hardware, with no ordinary operating system under it. It's the first thing the machine starts. Examples are VMware ESXi, Microsoft Hyper-V, and KVM, which is built into the Linux kernel and turns Linux itself into a hypervisor. Server rooms, like the one at Ivy's school, use this kind. With fewer layers, it's fast, and easier to protect.
Type 2
Hosted Hypervisors as Ordinary Apps
A type 2 hypervisor, also called hosted, is an ordinary program running on a normal host operating system, just like a browser. Oracle's VirtualBox and VMware Workstation are examples. You install one on a laptop, open it, and start VMs in windows. It's easy, and perfect for learning, testing, and desktops. The price is one extra layer. A guest's request passes through the hypervisor, then through the host operating system, and only then reaches the hardware.
Common Mistake
Type 1 Is Not Simply Better
A common mistake is to think type 1 means better, and type 2 means worse. They're built for different jobs. A server room wants speed and tight control, so it picks type 1. A learner with one laptop wants a guest in a window, so type 2 is the right tool. Some products even blur the line. So treat the two types as a helpful way to sort, not a strict law.
The Core Problem
When the Guest Is Not the Boss
The second way to sort is by how the guest and the hypervisor cooperate. A guest system is used to being the boss, in kernel mode, from lesson 2.3. But in a VM it isn't the boss. The hypervisor is. So when the guest tries a powerful action, such as changing its page tables, someone must step in. There are three famous ways to do that.
Three Techniques
Full, Para, and Hardware-Assisted
Full virtualization: the guest runs unmodified. The hypervisor catches or rewrites its sensitive actions, so the guest never knows. Any ordinary system works. Paravirtualization: the guest system is changed so it knows it's in a VM. Instead of trying powerful actions, it calls the hypervisor, with a hypercall. A hypercall is like a system call, but to the hypervisor. That cuts the work of catching, but the guest must be modified. Xen is a well-known hypervisor that supports it. Hardware-assisted virtualization: the processor helps. Intel calls its feature VT-x, and AMD calls its feature AMD-V. The chip runs the guest at full speed, and hands control to the hypervisor automatically whenever a sensitive action happens.
Current Practice
VT-x, AMD-V, and Paravirtual Drivers
Today almost every desktop and server processor has VT-x or AMD-V, and most modern hypervisors rely on it. That's why a computer's firmware may have a setting to switch it on or off, which lesson 10.5 revisits. And paravirtual ideas live on, in the special drivers a guest installs to speed up its disk and network, from lesson 10.4.
Quick Check
An Old Chip and an Unchanged Guest
Quick check. An old server's chip has no virtualization help built in. The guest is a stock copy of an everyday operating system, never altered. Which technique is left for the hypervisor? Pause, and decide. Full virtualization. The hypervisor has to catch, or rewrite, the guest's sensitive actions in software. Hardware assist is out, because the chip has no VT-x or AMD-V. Paravirtualization is out, because the guest was never changed to make hypercalls. That's exactly how early PC hypervisors ran ordinary systems, before processors helped.
Containers
Private Rooms Sharing One Kernel
A VM brings a whole guest operating system, with its own kernel. That's safe, but heavy: gigabytes of disk, and often a minute to boot. What if a program only needs its own private room, and not its own building? That's a container. A container is a group of processes that the host kernel walls off. They see their own files, their own process list, and their own network. But every container shares the host's one kernel. On Linux, kernel features called namespaces decide what a container can see, and control groups limit how much it may use. Tools like Docker package programs this way.
Comparison
VMs Versus Containers Row by Row
Here are the differences, row by row. A VM holds a full guest system with its own kernel. A container holds one app and its libraries, and shares the host's kernel. So a VM is larger and slower to start, but its wall is stronger, with separate kernels. A container is small and quick, but all of them lean on one kernel. And a VM can run a different operating system from the host. A container can't. It needs the same kernel family.
Quick Check
Linux Containers on a Mac
Quick check. Ivy runs a Linux container with a tool called Docker Desktop, on a Mac. Containers share their host's kernel, but macOS isn't Linux. So where does the Linux kernel come from? Pause, and decide. A small Linux VM. Docker Desktop quietly runs a Linux virtual machine on the Mac, and the containers share that VM's kernel. The macOS kernel doesn't speak Linux's system calls. And a container never brings a kernel of its own: that's exactly what makes it light. That's containers inside a VM. Companies do it on purpose, too, to get the strong wall of a VM and the light packaging of a container.
Decision Rule
Does the Job Need Its Own OS
To choose, ask one question: does this job need its own operating system? If yes, say a Windows program on a Linux host, or a strict wall between customers, use a VM. If it needs a clean, repeatable place for one app, a container is lighter. Back to Sam's small program: one little Linux program for the shop. Does it need its own system? No. So a container is plenty.
Key Takeaways
Hypervisors and Containers Reviewed
To recap. A type 1 hypervisor runs on the bare hardware. A type 2 hypervisor is an app on a host operating system. Full virtualization runs unmodified guests, paravirtualization uses hypercalls, and VT-x or AMD-V lets the chip help. And a container shares the host's kernel: lighter than a VM, but it can't run another operating system.
About Introduction to Operating Systems at UPI Study
Introduction to Operating Systems (Computer Science 354) is a self-paced online course of 83 video lessons in 10 chapters, from what an operating system does and process scheduling to concurrency, memory, devices, file systems, networks, the internet, security and virtual machines. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Compare: Linux vs Operating Systems
Why take it here
Why students take Introduction to Operating Systems with UPI Study
Where the credit goes
Universities that work with NCCRS
Introduction to Operating Systems carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Types of Virtualization
What is the difference between a type 1 and a type 2 hypervisor?
What is paravirtualization?
What is the difference between a container and a virtual machine?
How do Linux containers isolate processes?
About the Introduction to Operating Systems course
How many college credits is Introduction to Operating Systems?
How much does Introduction to Operating Systems cost and what is included?
Which universities accept UPI Study credits?
How long does Introduction to Operating Systems take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Introduction to Operating Systems.
83 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
Updated
3 credits · NCCRSEnroll →