AlgoMaster Logo

Setting Up Your Environment

21 min readUpdated August 9, 2026
Listen to this chapter
Unlock Audio

Operating-system concepts become much easier to understand when you can observe them on a real system.

Throughout this course, you will compile small programs, inspect running processes, trace system activity, explore memory usage, and experiment with files, threads, and network connections.

For a consistent experience, the practical exercises in this course use Linux.

You do not need to replace your current operating system. Windows and macOS users can run Linux alongside their existing environment.

Why This Course Uses Linux

Linux provides direct access to the tools and interfaces commonly used to study operating systems.

It allows us to inspect running processes through /proc, trace system calls with strace, compile C programs with GCC, examine open files, and work with the same command-line tools commonly found on backend servers.

The concepts taught in this course apply to other operating systems as well. Processes, threads, scheduling, virtual memory, file systems, and synchronization are not exclusive to Linux.

However, their commands and internal implementations differ. Using one environment prevents every practical exercise from becoming a separate tutorial for Linux, Windows, and macOS.

Unless stated otherwise, commands in this course assume a Linux terminal running Bash or a compatible shell.

Choosing Your Environment

The recommended setup depends on your current operating system.

Your systemRecommended environment
LinuxUse your existing Linux installation
WindowsInstall Ubuntu using WSL 2
macOSUse an Ubuntu virtual machine
Browser-only deviceUse a cloud-based Linux environment

Native Linux provides the most complete experience.

WSL 2 is the recommended choice for Windows because it lets you run a Linux environment directly alongside Windows. Microsoft supports installing it with a single wsl --install command, and new installations use WSL 2 by default.

macOS includes a Unix-style terminal and can run many of the basic examples. However, tools and interfaces such as strace, Linux /proc, namespaces, and cgroups are Linux-specific. A Linux virtual machine provides the most consistent experience for the complete course.

Setting Up Linux

If you already use Ubuntu or another Debian-based Linux distribution, open a terminal and update the package list:

Install the tools used throughout the course:

This gives you:

|Tool|Purpose|

|gcc|Compiles C programs| |make|Automates program builds| |gdb|Debugs running programs| |strace|Traces system calls| |ltrace|Traces library calls| |ps|Displays running processes| |lsof|Displays open files and sockets| |man|Opens command and programming documentation| |git|Downloads and manages course code|

You do not need to learn all these tools immediately. They will be introduced gradually when they become relevant.

Setting Up Windows with WSL 2

WSL, or Windows Subsystem for Linux, allows Windows users to run a Linux environment without setting up a traditional virtual machine or dual-boot system.

Open PowerShell as an administrator and run:

Restart your computer if Windows asks you to do so.

When Ubuntu starts for the first time, it will ask you to create a Linux username and password. This account is separate from your Windows account.

You can verify that Ubuntu is using WSL 2 by running the following command in PowerShell:

You should see output similar to:

After opening the Ubuntu terminal, install the course tools:

For the smoothest experience, keep your course files inside the Linux file system rather than a Windows-mounted directory.

Use a location such as:

rather than:

This avoids unnecessary differences in permissions, file-system behavior, and performance.

Setting Up macOS

You can complete basic command-line and C programming exercises directly from the macOS Terminal.

However, later chapters use Linux-specific features and tools. For the complete course, create a Linux virtual machine and install a recent Ubuntu release inside it.

Once the virtual machine is running, open its terminal and install the required tools:

A container can also provide a Linux command line for many exercises. However, containers share the host’s underlying kernel environment and may restrict low-level operations. A virtual machine is therefore more reliable for chapters involving process internals, resource controls, and kernel-specific behavior.

Docker officially provides installation options across Linux, Windows, and macOS, but Docker is optional for this course rather than the primary learning environment.

Creating Your Course Workspace

Keep all course programs in a dedicated directory.

Run:

The ~ symbol represents your home directory.

You can create separate directories as the course progresses:

Your workspace will look like this:

You can use any code editor you prefer. The only requirement is that you can create files inside this directory and run commands from the Linux terminal.

Verifying Your Setup

Let us confirm that the compiler and terminal are working correctly.

Create a file named hello.c:

Save the file inside your course workspace and compile it:

The gcc command compiles the source file and creates an executable named hello.

Run it:

You should see:

The ./ prefix tells the shell to run the executable named hello from the current directory.

You have just completed the basic program lifecycle:

  1. hello.c is source code.
  2. gcc compiles it.
  3. hello is the resulting executable file.
  4. ./hello is a running process.

The first three are files sitting on disk. Only the last one is alive, holding memory and consuming CPU time. We will examine each part of this lifecycle in later chapters.

Inspecting Your Environment

Run the following command:

It displays basic information about the operating system and kernel.

Next, check your processor architecture:

Common results include:

or:

Now confirm that the main course tools are available:

The exact version numbers are not important. Each command should run without reporting that the program was not found.

You can also confirm your current user and directory:

whoami prints your Linux username, while pwd prints the path of your current directory.

Understanding Course Commands

Commands in this course will usually appear like this:

Only type the command itself. Do not include any prompt characters that your terminal may display before it.

Linux paths and commands are case-sensitive. For example, Programs, programs, and PROGRAMS are treated as different names.

Several symbols will appear frequently:

SymbolMeaning
~Your home directory
.The current directory
..The parent directory
/The root directory or a path separator
*Matches multiple file names
>Redirects command output to a file
|Sends one command’s output to another command

You do not need to memorize all of them now. The relevant commands will be explained when they are first used. Ubuntu also maintains an introductory command-line guide for learners with no previous terminal experience.

Using sudo Safely

Some installation commands begin with sudo.

sudo runs a command with administrative privileges. It is needed when installing system packages or changing protected configuration.

Most course programs should run as your normal user.

Do not add sudo to a command simply because it fails. First understand why the operation needs additional permissions. Running experimental programs with administrative privileges can allow a bug to modify files or settings across the entire system.

A good rule is:

Use sudo for environment setup, but run your own programs as a normal user.

Stopping a Running Program

Some programs in this course will continue running until you stop them.

To interrupt the program currently attached to your terminal, press:

This does not close the terminal. It sends an interrupt request to the running process.

You will later learn how the operating system delivers and handles this request.

To leave a terminal session, run:

When Something Does Not Work

First confirm that you are using the expected environment:

For the full course, the output should be:

If a command is missing, update the package list and install the relevant package again.

For example:

If a compiled program cannot be found, make sure you are in the correct directory:

If the executable exists but does not run when you type its name, include ./:

When debugging an environment problem, read the complete error message. It usually identifies whether the problem is a missing file, missing command, incorrect permission, or invalid argument.

Summary

The practical exercises in this course use Linux so that every learner works with the same commands, tools, and operating-system interfaces.

Linux users can work directly on their system. Windows users should use WSL 2, while macOS users should use a Linux virtual machine for full compatibility.

Your environment should include a C compiler, debugger, system-call tracer, process tools, manual pages, and Git.

Before continuing, make sure you can successfully compile and run the hello.c program.

The goal is not to master every tool immediately. This environment gives us a place to observe operating-system concepts as we learn them.