1. LPU MCA Semester 1
  2. CAP470
  3. Unit 4

CAP470 · Unit 4: Containers

Containers versus virtual machines

10 practice questions · in the MTE and ETE syllabus

Key points

  • Containers share a kernel, VMs have their own
  • Containers are lighter, faster and denser
  • VMs give stronger isolation and OS variety
  • Containers inside VMs combine both strengths

Containers virtualize the operating system, while VMs virtualize the hardware.

AspectContainerVirtual machine
Kernelshares the host kernelown guest kernel
Sizemegabytesgigabytes
Startupseconds or lesstens of seconds to minutes
Densityvery highlower
Isolationprocess-level, weakerhardware-level, stronger
Different OSno, must match host kernelyes

Use containers for many small, fast-starting, scalable services and VMs for strong isolation, different operating systems or untrusted code. Many clouds run containers inside VMs to combine VM isolation with container portability, for example running each customer's containers in a separate VM.

Exam trap: containers trade some isolation for density and speed, so shared-kernel containers are not the safest boundary for untrusted code.

Try two questions

Question 1 · Tier 4, Analyse

Which comparison between containers and VMs is correct?

  1. Containers virtualize the hardware, while VMs virtualize the operating system
  2. Both virtualize only the network cards
  3. Neither virtualizes anything at all
  4. Containers virtualize the operating system, while VMs virtualize the hardware
Show the answer

D. A VM abstracts hardware for a guest OS, and a container abstracts the OS for its processes.

Why not A: This reverses the two.

Why not B: Neither is limited to network cards.

Why not C: Both provide some level of virtualization.

Question 2 · Tier 3, Apply

A start-up needs thousands of short-lived tasks to launch within a second. Which technology fits best?

  1. Virtual machines that each boot a guest OS
  2. Containers
  3. Physical servers ordered for each task
  4. Manually installed software on one server
Show the answer

B. Containers start in seconds or less because they do not boot a guest OS.

Why not A: VM boot time is much longer.

Why not C: Ordering servers takes far too long.

Why not D: Manual installs cannot launch thousands of tasks within a second.