COMP 3150Operating Systems

01 Introduction

Every laboratory, programming assignment, and exercise in this course runs on Linux. Not because Linux is the only operating system worth studying — the course covers general principles that apply to any modern OS — but because Linux is the one whose source code you can read, whose behaviour you can inspect from the inside, and whose development tools are available without cost or license negotiation. Working on Linux is how you will observe the mechanisms this course discusses.

Rather than requiring you to install Linux directly onto your computer (which risks data loss and configuration conflicts), the course is built around a virtual machine: a Linux system running as an application inside whatever operating system you already use. The VM is fully isolated from your host system. You can experiment on it freely, take snapshots before risky changes, and discard and recreate it if anything goes wrong. When you finish the course, you simply delete the VM.

This lesson walks you through the entire setup. By the end you will have a working Linux VM with all the tools the course requires, a verified toolchain, and a baseline snapshot you can return to whenever you need. Everything that follows in Module 1 — and every module after it — assumes you have completed this lesson.

How long this takes

Budget 60–120 minutes, depending on your network speed and the platform you choose. Most of the time is spent waiting for downloads and installations; the actual configuration steps are quick. If you have a slow connection, plan to do this in two sessions and take a snapshot between them.

02 Learning objectives

By the end of this lesson you will be able to

  • Choose a virtualization platform for your host system.
  • Download and verify a Linux distribution image.
  • Create and configure a virtual machine.
  • Install a Linux distribution inside the VM.
  • Install and verify the course development toolchain.
  • Take a baseline snapshot for future recovery.

This is an orientation lesson. It does not directly contribute to a course learning outcome, but it is a prerequisite for the laboratories that do — specifically CLO6 (apply Linux systems-programming techniques) and CLO8 (design and implement OS components).

03 Required reading

There is no textbook reading for this lesson. The required material is the documentation for the platform you choose:

  • VirtualBox — Oracle VM VirtualBox User Manual, Chapters 1–3 (installation, basic concepts, and creating a VM). Available at virtualbox.org/manual/.
  • VMware Workstation Player — VMware Workstation Player Documentation on the VMware website (hosted on docs.vmware.com).
  • UTM (macOS on Apple Silicon) — the UTM documentation at docs.getutm.app.
  • WSL2 (Windows Subsystem for Linux) — the Microsoft documentation for WSL, particularly the installation guide and the section on choosing a Linux distribution.
  • Ubuntu — the current LTS release notes and the Ubuntu Server or Desktop installation guide at ubuntu.com.

Skim the platform docs, don't read them cover to cover

You need the sections on installation, creating a VM, and installing a guest OS. Everything else can wait. The point of the reading is to orient you before you start clicking buttons; the detailed walkthrough in this lesson will guide you through the actual work.

04 Core content

4.1 Why the course uses a virtual machine

Four reasons drove the decision to standardise the course on a VM rather than asking students to install Linux directly:

Isolation
The VM is a separate operating system. Nothing you do inside it can affect your host machine's files, applications, or configuration. You can experiment with low-level system interfaces — creating hundreds of processes, filling memory, corrupting a kernel module — without any risk to your real work.
Reproducibility
Every student in the course runs the same Linux distribution, the same kernel, the same toolchain, the same library versions. When the course notes say "run this command and observe this output," the output will match. When you encounter a problem, the instructor and your classmates have an identical environment to reproduce it.
Safety net
You can take a snapshot of the VM at any moment and return to it later. If a laboratory exercise goes badly — you corrupt the kernel, you delete something you needed, you want to start over — you can restore the snapshot and try again without rebuilding from scratch.
Portability
The VM is a set of files. You can copy it to another computer, carry it on an external drive, back it up to the cloud, or (with some adjustment) migrate it between virtualization platforms. Your work travels with you.

4.2 Choosing a virtualization platform

Which platform you use depends on your host operating system and its hardware. The table below summarises the options. All of them will run the course VM; they differ in performance, ease of installation, and available features.

Virtualization platforms by host OS
Host OS Recommended platform Alternatives
Windows 10 / 11 VirtualBox (free, easy) VMware Workstation Player, Hyper-V, WSL2
macOS (Intel) VirtualBox or VMware Fusion UTM, Parallels Desktop (commercial)
macOS (Apple Silicon) UTM (free) or VMware Fusion Parallels Desktop; note: x86 emulation is slow, use arm64 guests
Linux VirtualBox or KVM/QEMU (virt-manager) VMware Workstation Player, GNOME Boxes

Some notes on each:

  • VirtualBox is free, open source, and runs on every major host OS. It is the simplest choice and works well for the workloads this course uses. It uses hardware-assisted virtualization on modern CPUs, so performance is close to native for most operations.
  • VMware Workstation Player (Windows, Linux) and VMware Fusion Player (macOS) are commercial products with free licenses for personal and educational use. They generally perform slightly better than VirtualBox, and they are more polished. VMware Fusion on Apple Silicon supports arm64 Linux guests natively.
  • UTM is the recommended choice on Apple Silicon Macs. It is a front end for QEMU and uses Apple's Hypervisor framework for near-native performance with arm64 guests. It is free and open source.
  • WSL2 (Windows Subsystem for Linux) is not a virtual machine manager in the traditional sense; it runs a real Linux kernel inside a lightweight Hyper-V VM managed by Windows. It is very convenient but has limitations for this course — notably, no graphical desktop by default and a slightly different filesystem layout. It works, but only choose it if you are already comfortable with it.
  • Hyper-V (Windows Pro editions) is Microsoft's built-in hypervisor. It is powerful but less beginner-friendly than VirtualBox. If you already use Hyper-V for other purposes, it will work; otherwise stick with VirtualBox.
  • KVM/QEMU with virt-manager or GNOME Boxes is the natural choice on Linux hosts. It is what production systems use, and the performance is excellent.

Do not use both Hyper-V and VirtualBox at once

If you have Hyper-V enabled on Windows, VirtualBox will run in a compatibility mode that is much slower. Either disable Hyper-V (if you are not using it) or use a platform that works with it — WSL2, or VirtualBox 7+ which supports the Hyper-V API. Check the VirtualBox documentation for your version.

4.3 Hardware requirements

The course VM needs enough resources to run Linux comfortably alongside whatever else your host machine is doing. The following is the recommended allocation:

Recommended VM resource allocation
Resource Minimum Recommended Notes
RAM 2 GB 4 GB Enough for a desktop and the toolchain. 2 GB works but is tight.
vCPUs 1 2 Assign at most half of your host's cores.
Disk 20 GB 40 GB Dynamically allocated; grows only as needed.
Disk type VDI / VMDK / qcow2 Same Any format your platform supports. Use dynamic allocation.
Network NAT NAT NAT is simplest; gives internet access without extra configuration.

Your host needs sufficient free resources to spare. If your host has only 8 GB of RAM, allocating 4 GB to the VM leaves 4 GB for the host — workable, but not generous if you plan to run a browser, an IDE, and a VM simultaneously. Adjust as needed. Never allocate more than half of your host's physical RAM to a VM.

4.4 Downloading the Ubuntu LTS image

The course standardises on Ubuntu Desktop LTS — the current Long Term Support release. LTS versions are supported for five years and are the stable choice for production and coursework alike. Ubuntu Desktop is used rather than Ubuntu Server because it provides a graphical interface, which is easier for students who are not already familiar with Linux.

Download the ISO from the official Ubuntu website (ubuntu.com/download/desktop). Do not download from mirrors you do not recognise. The image is approximately 4–5 GB.

Verify the download. This is not optional — a corrupted ISO will produce mysterious installation failures that are hard to diagnose. Ubuntu publishes SHA-256 checksums alongside the download link.

# Linux or macOS host
$ sha256sum ubuntu-24.04-desktop-amd64.iso
# Compare to the published checksum

# Windows host (PowerShell)
PS> Get-FileHash -Algorithm SHA256 ubuntu-24.04-desktop-amd64.iso

Choose arm64 for Apple Silicon

If you are on an Apple Silicon Mac, download the arm64 build of Ubuntu rather than the amd64 one. Running an x86_64 guest on Apple Silicon requires full CPU emulation, which is 10–20× slower than native. The arm64 build runs at near-native speed. Current Ubuntu LTS releases provide arm64 images for desktop and server.

4.5 Creating the virtual machine

The steps differ slightly by platform but follow the same sequence. The exact menu names below assume VirtualBox; the other platforms are conceptually identical.

  1. Open the VM manager. Launch VirtualBox (or your chosen platform) and click New to create a virtual machine.
  2. Name and OS type. Give the VM a recognisable name, such as COMP3150-Ubuntu. Set the type to Linux and the version to Ubuntu (64-bit) (or Ubuntu (arm64) on Apple Silicon). The type helps the platform pick sensible defaults; the name is for you.
  3. Memory. Allocate 4096 MB (4 GB) if your host has 8 GB or more; 2048 MB (2 GB) otherwise. Do not exceed half of your host's RAM.
  4. Virtual hard disk. Create a new disk. Choose VDI (or VMDK for VMware; qcow2 for QEMU). Choose dynamically allocated so the disk file grows only as needed. Set the size to 40 GB.
  5. Configure CPUs. After creating the VM, open its settings, go to System → Processor, and allocate 2 virtual CPUs. Enable PAE/NX and (if available) nested paging.
  6. Enable hardware acceleration. In System → Acceleration, enable VT-x/AMD-V (Intel/AMD host) or the equivalent hypervisor framework (Apple Silicon). Without this, performance will be unacceptable.
  7. Attach the ISO. In the VM's settings, go to Storage, select the optical drive, and attach the Ubuntu ISO you downloaded. Mark the drive as a live CD so that the VM boots from it the first time.
  8. Network. Leave the network mode at NAT, which is the default and gives the VM internet access with no additional configuration. You can switch to bridged mode later if you need the VM to be visible on your local network.
  9. Start the VM. Click Start. The VM will boot from the ISO into the Ubuntu installer.

4.6 Installing Ubuntu

The Ubuntu installer is a graphical wizard. The steps are:

  1. Choose language and keyboard layout. English and US (or your regional equivalent) are fine.
  2. Installation type. Choose Normal installation — the "minimal" option excludes software you will need. If asked, allow the installer to download updates during installation (it saves a step later).
  3. Disk setup. Because the VM has an empty virtual disk, choose Erase disk and install Ubuntu. This only affects the virtual disk, not your host. Do not worry about the ominous warning text — the installer does not know it is in a VM.
  4. User account. Create a user account for yourself. Use a name you will recognise (e.g., your first name). Choose a strong password — you will type it often, and sudo prompts will ask for it. Set the hostname to something short like comp3150-vm.
  5. Wait for the installation. This takes 10–30 minutes depending on your hardware. During the install, the ISO is copied to the virtual disk and packages are unpacked.
  6. Reboot. When the installer finishes, it will prompt you to restart. Remove the ISO from the virtual optical drive if prompted (VirtualBox usually does this automatically on first boot).
  7. First boot. Log in with the account you created. You should arrive at the Ubuntu desktop.

Install Guest Additions / VMware Tools

Guest Additions (VirtualBox) or VMware Tools (VMware) provide better display resolution, shared clipboard, shared folders, and improved performance. On VirtualBox: with the VM running, select Devices → Insert Guest Additions CD image, then run the installer from within Ubuntu. On Ubuntu 22.04 and later, the additions are often already present or can be installed with sudo apt install virtualbox-guest-utils virtualbox-guest-dkms.

4.7 Post-installation configuration

A freshly-installed Ubuntu is close to ready but needs a few adjustments before you begin the course.

Update the system

The first thing to do after installation is bring the system up to date. This installs security patches and the latest package metadata.

$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt autoremove -y

If the upgrade includes a kernel update (likely on a new install), you will need to reboot:

$ sudo reboot

Install the course toolchain

The course uses a standard set of tools: compilers, build automation, version control, and debugging utilities. On Ubuntu, most of them are bundled in the build-essential meta-package.

$ sudo apt install -y \
    build-essential \
    gdb \
    git \
    make \
    valgrind \
    strace \
    ltrace \
    man-db \
    manpages-dev \
    pkg-config

What each package provides:

  • build-essential — GCC, make, and the standard C library headers and development files.
  • gdb — the GNU debugger.
  • git — version control.
  • valgrind — memory-error detector.
  • strace and ltrace — system-call and library-call tracers.
  • man-db and manpages-dev — man pages, including the "Section 2" pages documenting system calls.
  • pkg-config — a helper for finding library compile/link flags, used by many build systems.

Set Git identity

Git records the author of every commit. Set your name and email before you start using it:

$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"
$ git config --global init.defaultBranch main

Update the shell prompt (optional)

Ubuntu's default prompt is minimal. A prompt that shows the current directory and the exit status of the last command is considerably more useful. Many students install a preconfigured theme such as powerline or use oh-my-bash. This is not required for the course — the default prompt works fine — but it is worth doing if you find yourself typing pwd often.

4.8 Verifying the toolchain

Before declaring the environment ready, verify each tool is present and reports a reasonable version. Run the following commands and confirm the output resembles what is shown:

$ gcc --version
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
...

$ make --version
GNU Make 4.3
...

$ git --version
git version 2.43.0

$ gdb --version
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403
...

$ valgrind --version
valgrind-3.22.0

$ strace -V
strace -- version 6.7

$ man 2 write | head -5
WRITE(2)                   Linux Programmer's Manual                  WRITE(2)

NAME
       write - write to a file descriptor

The last command — man 2 write — is particularly important. It verifies that the man pages for system calls (section 2) are installed. These are the pages you will consult most often in this course, and they are in a separate package (manpages-dev) from the default manual.

A quick smoke test

To make sure the entire toolchain works end to end, compile a tiny program:

$ cat > hello.c << 'EOF'
#include <stdio.h>
int main(void) {
    printf("toolchain works\n");
    return 0;
}
EOF

$ gcc -Wall -Wextra -g -o hello hello.c
$ ./hello
toolchain works

If this prints toolchain works, your development environment is functional. If it does not, the compiler produced an error — read it, and consult section 4.11 below for common problems.

4.9 The course directory structure

Before you begin the lessons, create the workspace structure that the course will use. Every laboratory and exercise will assume these directories exist.

$ mkdir -p ~/comp3150/{labs,exercises,notes}
$ cd ~/comp3150
$ git init
Initialized empty Git repository in /home/alice/comp3150/.git/

$ cat > .gitignore << 'EOF'
*.o
*.a
*.so
*.out
a.out
build/
core
core.*
*.log
*.swp
*~
EOF

$ git add .gitignore
$ git commit -m "Initialise COMP 3150 workspace"

The three directories serve different purposes:

  • labs/ — one subdirectory per laboratory. Each laboratory will be its own Git repository inside this directory.
  • exercises/ — free-form practice code. Not graded; use it for experiments and scratch work.
  • notes/ — your notes and any small reference files you find useful. The course will not place files here, but you will appreciate having a dedicated space.

4.10 Snapshots: your safety net

A snapshot is a record of the VM's complete state at a point in time — the disk contents, the memory, the running processes. The VM can be reverted to a snapshot at any moment, discarding all changes made since.

Snapshots are the single most valuable feature of working in a VM. They turn potentially destructive experiments into reversible ones. The following practice is strongly recommended for this course:

  1. Take a baseline snapshot now. With the freshly-installed system, verified toolchain, and empty workspace, take a snapshot called clean-install. This is your recovery point if anything goes wrong later.
  2. Take a snapshot before each laboratory. Once the environment is set up for Lab n, snapshot it as before-lab-n. If the lab goes badly, you revert to the snapshot and start over with a clean environment.
  3. Do not accumulate snapshots indefinitely. Each snapshot stores the differences between itself and the previous state, and the disk usage adds up. Delete old snapshots you no longer need.

In VirtualBox, snapshots are managed from the Snapshots tab of the VM's main window. In VMware, they are under VM → Snapshot → Take Snapshot. In UTM, they are exposed as "Save State" and can be managed from the VM's settings. The exact menu names differ, but the concept is the same on every platform.

Snapshots are not backups

A snapshot lives on the same physical disk as the VM itself. If that disk fails, or the VM's files are deleted, both the VM and its snapshots are lost. Snapshots protect against mistakes inside the VM, not against hardware failure or accidental deletion. For real backup, copy the VM's files to another physical device or to cloud storage periodically.

4.11 Sharing files with the host

You will occasionally want to move a file between the VM and your host machine — a screenshot for a report, a downloaded PDF, source code for an assignment. The standard method is a shared folder.

In VirtualBox: with the VM running, select Devices → Shared Folders → Shared Folder Settings. Add a folder from your host, give it a name (e.g., host-share), and enable auto-mount. The folder will appear inside the guest under /media/sf_<name>. Your user must be a member of the vboxsf group to access it:

$ sudo usermod -aG vboxsf $USER
# log out and back in for the change to take effect

VMware Tools and UTM provide equivalent features under different names. Alternatively, most platforms support a shared clipboard that lets you copy and paste text (though not files) between host and guest.

If you prefer not to configure a shared folder, you can also transfer files over the network — run an SSH server in the VM and use scp or rsync from the host, or use a cloud service such as a Git remote or a file-sharing tool that works from inside the VM.

4.12 Troubleshooting common issues

The VM is extremely slow, or the install seems hung

Most likely hardware virtualization is disabled in your host's BIOS/UEFI, or the platform cannot use it. On Intel hosts, look for "Intel VT-x" or "Virtualization Technology" in the firmware settings; on AMD, look for "AMD-V" or "SVM Mode." Enable it and reboot. On Windows, also verify that Hyper-V and the Windows Hypervisor Platform are not blocking VirtualBox — see section 4.2's warning.

The display resolution inside the VM is tiny or the window cannot be resized

Guest Additions (VirtualBox) or VMware Tools have not been installed. Install them as described in the callout in section 4.6, then reboot the VM. The display should auto-resize to fit the window.

Cannot copy/paste between host and VM

The shared clipboard is disabled by default. Enable it from the VM's settings: General → Advanced → Shared Clipboard → Bidirectional. This also requires Guest Additions to be installed and running.

"No space left on device" during install, but the disk was created as 40 GB

The dynamic disk file has probably grown to the host's available free space. Check the host's disk usage — the VM's disk file counts toward it. Free up space on the host, or move the VM to a larger drive.

Ubuntu boots to a blank screen or an emergency shell

A kernel update may have completed without rebooting, or the guest additions kernel modules are out of sync. Try booting into the previous kernel from the GRUB menu (hold Shift during boot to see the menu), then reinstall guest additions: sudo apt install --reinstall virtualbox-guest-dkms.

Cannot install guest additions because the CD-ROM drive does not exist

Some minimal Ubuntu installs do not create a CD-ROM device. Use the packages from the Ubuntu repository instead: sudo apt install virtualbox-guest-utils virtualbox-guest-dkms. This provides the same functionality without needing the ISO.

apt reports that some packages cannot be authenticated

Usually a clock-skew problem — the VM's clock is out of sync with the host's, and apt's signature checking rejects packages as "not yet valid." Fix the clock with sudo apt install ntpdate && sudo ntpdate pool.ntp.org, then retry the install.

Host is a corporate-managed laptop and virtualisation is restricted

Some employers disable hardware virtualization or block hypervisors. If you cannot enable VT-x/AMD-V, you have two alternatives: (1) run the VM in the cloud — a student account on a major cloud provider, or an institution-provided Linux shell; (2) use WSL2 on Windows, which typically works even in restricted environments. Contact your instructor if neither works.

4.13 When you are ready

Before you consider the setup complete, confirm the following:

  • The VM boots into Ubuntu Desktop with a working graphical interface.
  • sudo apt update succeeds and the system is up to date.
  • Each tool in the verification list from section 4.8 produces the expected output.
  • The smoke-test program compiles and runs.
  • The ~/comp3150/ workspace exists with its Git repository and initial commit.
  • A baseline snapshot named clean-install has been taken.

When all of these are true, you are ready to begin Lesson 1.1.

05 Worked example

The following is a complete transcript of the setup process for a VirtualBox-based Ubuntu VM. Follow it step by step if you are on Windows or an Intel-based Mac and have not created a VM before.

Step 1: download and verify the ISO

Download ubuntu-24.04-desktop-amd64.iso from ubuntu.com/download/desktop. Then verify the SHA-256 checksum against the value published on the download page.

# On Windows (PowerShell)
PS> Get-FileHash -Algorithm SHA256 ubuntu-24.04-desktop-amd64.iso
Algorithm  Hash                                                                Path
---------  ----                                                                ----
SHA256     A4B4D1E1C4E1F8A7...                                                C:\Users\alice\Downloads\...
# Compare to the checksum on the Ubuntu website. They should match exactly.

Step 2: create the VM

Open VirtualBox, click New, and fill in:

Name:     COMP3150-Ubuntu
Type:     Linux
Version:  Ubuntu (64-bit)
Memory:   4096 MB
CPU:      2 (configured after creation in Settings → System → Processor)
Disk:     Create a virtual hard disk now
          VDI (VirtualBox Disk Image)
          Dynamically allocated
          40.00 GB

Step 3: attach the ISO and boot

In the VM's settings, go to Storage. Under the "Controller: IDE" node, click the empty optical drive, then the small disc icon on the right, and choose Choose a disk file.... Select the Ubuntu ISO you downloaded. Click OK, then Start the VM.

Step 4: install Ubuntu

The VM will boot into the Ubuntu live session. Follow the installer prompts:

Language:         English
Keyboard:         English (US)
Installation:     Normal installation
Other options:    Download updates while installing Ubuntu
Disk:             Erase disk and install Ubuntu
                  (this affects only the VM's virtual disk)
Timezone:         Your local timezone
User:             Name:     Alice Example
                  Hostname: comp3150-vm
                  Username: alice
                  Password: (a strong password)

The installation takes 15–30 minutes. When it finishes, click Restart Now and press Enter when the VM prompts you to remove the installation medium.

Step 5: post-install update and toolchain

Log in with the account you created. Open a terminal (Ctrl+Alt+T is the default shortcut on Ubuntu) and run:

$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt autoremove -y

$ sudo apt install -y \
    build-essential gdb git make valgrind strace ltrace \
    man-db manpages-dev pkg-config

$ git config --global user.name "Alice Example"
$ git config --global user.email "alice@example.com"
$ git config --global init.defaultBranch main

Step 6: verify everything

$ gcc --version | head -1
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

$ make --version | head -1
GNU Make 4.3

$ git --version
git version 2.43.0

$ gdb --version | head -1
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403

$ man 2 write | head -1
WRITE(2)                   Linux Programmer's Manual                  WRITE(2)

Step 7: smoke test

$ cat > /tmp/hello.c << 'EOF'
#include <stdio.h>
int main(void) { printf("ready for COMP 3150\n"); return 0; }
EOF

$ gcc -Wall -Wextra -g -o /tmp/hello /tmp/hello.c
$ /tmp/hello
ready for COMP 3150

Step 8: create the workspace

$ mkdir -p ~/comp3150/{labs,exercises,notes}
$ cd ~/comp3150
$ git init
$ cat > .gitignore << 'EOF'
*.o
*.a
*.so
*.out
a.out
build/
core
core.*
*.log
*.swp
*~
EOF
$ git add .gitignore
$ git commit -m "Initialise COMP 3150 workspace"
[main (root-commit) c1a2b3d] Initialise COMP 3150 workspace
 1 file changed, 9 insertions(+)
 create mode 100644 .gitignore

Step 9: take a baseline snapshot

Shut down the VM (or leave it running). In VirtualBox, open the VM's Snapshots panel, click Take, and name the snapshot clean-install. You now have a complete record of the working environment.

When the smoke test prints ready for COMP 3150, the environment is complete.

06 Interactive activity

Activity · set up and verify your course environment

Work through the following steps on your own VM. Record the outputs in a text file in your ~/comp3150/notes/ directory — you may be asked to show evidence of the setup.

  1. Verify the toolchain. Run each of the verification commands from section 4.8 and paste the outputs into a file called toolchain-verification.txt. If any tool is missing, install it and re-run.
  2. Compile the smoke test. Create, compile, and run the "ready for COMP 3150" program. Note the size of the resulting executable with ls -lh.
  3. Check your kernel version and system info. Run the following and record the results:
    uname -a
    lsb_release -a
    free -h
    df -h
    nproc
    How much RAM does the VM have? How many CPUs? How much free disk space?
  4. Create the workspace. If you have not already, create ~/comp3150/ with the subdirectories labs/, exercises/, and notes/, and initialise a Git repository.
  5. Take a baseline snapshot. Name it clean-install. Then verify you can revert to it: create a test file in /tmp, revert to the snapshot, and confirm the file is gone.
  6. Test a destructive operation in safety. Create a file inside the VM and then delete it. Restore the snapshot. Verify the file is back. This is the safety net the rest of the course relies on — do not skip this test.
  7. Configure a shared folder (optional). If you want to move files between host and guest, set up a shared folder as described in section 4.11 and add yourself to the appropriate group.
  8. Document your setup. Write a short file ~/comp3150/notes/setup.md describing your platform, VM name, resource allocation, and any problems you encountered. This is useful for troubleshooting later and, if you work with classmates, useful for comparing setups.

Reflect: which of these steps would you repeat on a new machine? Which would you automate with a script? Which felt unnecessary until you understood why the course uses a VM at all?

07 Knowledge check

Check your understanding

Question 1

Why does the course use a virtual machine rather than asking students to install Linux on their computers directly?

Show answer
Four reasons: isolation — the VM is separated from the host, so experiments cannot damage the student's real files or configuration; reproducibility — every student runs the same environment, so commands and outputs match; safety net — snapshots allow reverting to a known-good state after mistakes; portability — the VM is a set of files that can be copied, backed up, or transferred between machines. Installing Linux directly would compromise all four properties.

Question 2

What is a snapshot, and what does it protect against?

Show answer
A snapshot captures the VM's complete state — its disk, memory, and running processes — at a point in time. Reverting to the snapshot discards all changes made since. It protects against mistakes inside the VM: accidentally deleting files, corrupting the system, ruining a laboratory exercise. It does not protect against hardware failure or accidental deletion of the VM's files on the host, because the snapshot lives on the same physical disk. For that, you need a real backup to another device.

Question 3

What does the build-essential package include, and why is it installed separately from other tools?

Show answer
build-essential is a meta-package that installs GCC, GNU Make, and the standard C and C++ library development files (headers and static libraries). These are the components needed to compile and link C and C++ programs. It is installed separately because a freshly-installed Ubuntu system does not include a compiler by default — Ubuntu's base installation is designed for ordinary use, not software development, so the toolchain is in a separate package. The other tools (gdb, git, valgrind, strace) are in their own packages because not every user needs them.

Question 4

Why is it important to verify the SHA-256 checksum of the Ubuntu ISO before installing?

Show answer
Because a corrupted ISO can produce installation failures that are very difficult to diagnose. The installer may crash, packages may fail to unpack, or the system may appear to install correctly but then misbehave unpredictably. The checksum comparison catches any corruption — whether from a network error, a faulty storage device, or a download interrupted and resumed — before the install begins. A five-second check saves potentially hours of troubleshooting.

Question 5

What are the recommended minimum and preferred resource allocations for the course VM, and why should RAM allocation not exceed half of the host's physical memory?

Show answer
The minimum is 2 GB RAM and 1 vCPU; the preferred is 4 GB RAM and 2 vCPUs. Do not exceed half the host's RAM because the host operating system and the hypervisor itself need memory to run. If the VM takes more than half, the host is forced to swap, which is extremely slow and can make both the host and the VM unresponsive. The general rule is to leave enough resources on the host for the host to operate comfortably — for a machine with 8 GB, 4 GB to the VM; for 16 GB, 4–8 GB to the VM.

08 Unit discussion

Discussion prompt

Virtualization changes how we think about a "computer." A physical server in a data centre, a VM in a public cloud, a container in a Kubernetes cluster, a WSL2 environment on a laptop — all of them present the same basic interface to the software running inside them, but the resources they consume and the guarantees they provide are very different.

Think about the VM you just created. In what sense is it "a computer"? In what sense is it a file on another computer? What would happen if the host were destroyed by a hardware failure — would the guest still exist? If the answer surprises you, this is the point at which the boundary between hardware and software becomes visible.

Post your response to the Unit 1 discussion forum and reply to at least two classmates. This orientation discussion prepares the ground for Unit 1's material on operating-system abstractions.

09 Practice exercise

This exercise ensures your environment is fully prepared for the course. Aim to spend 60–90 minutes on it — most of that will be waiting for downloads and installations.

  1. Complete the setup. Follow the worked example in section 5 through to step 9. Do not skip the checksum verification or the toolchain verification — both catch problems that would otherwise surface later, at inconvenient moments.
  2. Produce a setup report. Create ~/comp3150/notes/setup-report.md documenting:
    • Your host operating system and hardware.
    • The virtualization platform you chose and why.
    • The VM name, RAM, CPU count, and disk size.
    • The Ubuntu version installed.
    • The output of each verification command from section 4.8.
    • Any problems encountered and how you resolved them.
  3. Test the snapshot mechanism. Deliberately introduce a change to the system that you would not want to keep — for example, install a package you do not need, or create a directory in /etc with random files. Take a snapshot called test-before-revert, then revert to clean-install, and confirm the change is gone. Delete the test snapshot.
  4. Explore the guest environment. Run the following commands and note what each reveals:
    cat /etc/os-release
    cat /proc/cpuinfo | head -30
    cat /proc/meminfo | head -5
    lsblk
    ls /boot
    This is the first look at the kind of environment the course will be working in. Lesson 2.1 will explain the architecture behind what you are seeing.
  5. Commit the setup report. Add setup-report.md to the workspace repository and commit it. This file may be useful for the first laboratory and for troubleshooting in later weeks.
  6. Plan your backup strategy. Decide how you will back up the VM's files (a copy to an external drive, a cloud backup, or a scheduled copy to another machine). Write one sentence in the setup report describing your plan.

10 Summary

  • The course runs on a Linux virtual machine for isolation, reproducibility, safety, and portability.
  • Choose a virtualization platform appropriate to your host: VirtualBox for most cases, UTM for Apple Silicon, VMware Player for users who want commercial polish, or WSL2 on Windows if you already know it well.
  • Allocate at least 2 GB RAM (preferred 4 GB), 2 vCPUs, and 40 GB of disk. Never exceed half of the host's physical RAM.
  • Install Ubuntu Desktop LTS. Always verify the SHA-256 checksum of the downloaded ISO.
  • Install Guest Additions (or VMware Tools) for better display, shared clipboard, and shared folders.
  • After installation, update the system (apt update && apt upgrade), install the toolchain (build-essential gdb git make valgrind strace ltrace man-db manpages-dev), and configure Git's user identity.
  • Verify the toolchain by checking each version and compiling a smoke-test program. Also verify that man 2 write works — this confirms the system-call man pages are installed.
  • Create the ~/comp3150/ workspace with its Git repository and initial commit.
  • Take a baseline snapshot after setup, and take a snapshot before each laboratory. Snapshots are the mechanism that makes the course's experiments safe.

Ready for Lesson 1.1

With the environment set up and verified, you are ready to begin the conceptual material of Unit 1. Lesson 1.1 starts with the fundamental question: what is an operating system?

11 References

  • Oracle VM VirtualBox. Oracle VM VirtualBox User Manual. www.virtualbox.org/manual/.
  • VMware. VMware Workstation Player Documentation. docs.vmware.com.
  • UTM Project. UTM Documentation. docs.getutm.app.
  • Microsoft. Windows Subsystem for Linux Documentation. learn.microsoft.com/windows/wsl/.
  • Canonical. Ubuntu Desktop — Download and Installation Guide. ubuntu.com/download/desktop.
  • Canonical. Ubuntu Release Notes for the current LTS. discourse.ubuntu.com.
  • GNU Project. GCC Online Documentation. gcc.gnu.org/onlinedocs/.
  • Git Project. Pro Git, 2nd ed. Free online book at git-scm.com/book.
👤