Meet virtual machines
Learn what a VM is and why teams run many machines on one host.
- Explain what virtual machines virtualize and what they isolate.
A virtual machine (VM) is software that behaves like a computer. A host machine runs a hypervisor, and the hypervisor runs guest operating systems as VMs. Each VM gets virtual CPU, memory, storage, and networking. This lets teams isolate workloads, improve hardware utilization, and run different operating systems on the same physical server.
1vms = [
2 {"name": "api-vm", "cpu": 2, "memory_gb": 4},
3 {"name": "db-vm", "cpu": 4, "memory_gb": 8}
4]
5print(len(vms))
6print(vms[0]["name"])2 api-vm
Think of a VM as a clean sandbox with its own kernel and userspace. Containers share a host kernel; VMs do not. That extra isolation costs more overhead, but it is useful for multi-tenant systems, OS testing, and security boundaries.
Key takeaways
Explain what virtual machines virtualize and what they isolate.
VMs are powerful when automation and guardrails stay strong.
Observe before scaling; recover before incidents become outages.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: write Python
Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.
Count VM resources
Read two integers (vCPU count and memory in GB) for each of two VMs, then print the total as cpu=<sum> mem=<sum>.
- Small host
- Balanced VMs
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…