1 From Executing Code to Operating Systems
Winter Semester 2026/2027
An operating system is familiar enough that it is easy to begin with examples rather than with the problem it solves. Windows, Ubuntu, Android and macOS are recognizable operating-system environments, but naming familiar systems does not yet explain why operating systems exist.
BVS1 therefore starts with a smaller question:
Can a computer execute a program without an operating system?
The first practical system is deliberately tiny. We use QEMU to provide a machine with an RV64 (64-bit RISC-V) CPU. This is our target: the machine for which we build the program. It runs one program and prints:
Hello BVS1
The experiment gives us a concrete machine to reason about before we introduce operating-system mechanisms.
1.1 One program can run without a guest operating system
At the lowest level, a processor executes instructions. Those instructions operate on registers and memory and can communicate with devices.
One important idea of the stored-program / Von Neumann model is that instructions and data are both kept in memory.
A deliberately simplified machine model is:
instructions + data
│
▼
memory
▲
│
▼
CPU
│
▼
devices
This model omits many details of real hardware, but it is enough for the first distinction:
CPU, memory and devices exist independently of an operating system.
The point here is conceptual rather than historical or microarchitectural. Modern processors may use separate instruction and data caches internally, but the important point here is that instructions and data both occupy target memory. Lecture 2 returns to this idea and makes the abstract memory model concrete.
In the Hello BVS1 experiment, QEMU provides the target machine. The target contains an RV64 CPU, memory and devices. The program is loaded and begins executing without a guest operating system.
The physical computer still runs an operating system, and our Ubuntu development environment also runs an operating system. The important observation concerns the target:
Executing instructions is not, by itself, what makes an operating system necessary.
1.1.1 Interpreting the experiment
The classroom experiment deliberately separates observation from explanation. Consider these statements:
- QEMU executed our program.
- A virtual CPU executed our program.
- Ubuntu executed our guest program.
- The target had an operating system.
- QEMU was already running before our guest program started.
- The string
Hello BVS1existed somewhere in memory while the program was running.
The purpose of discussing them is to expose the execution model.
A precise description is:
- the Ubuntu development VM runs the QEMU process;
- QEMU implements the target machine;
- the target contains an emulated RV64 CPU, memory and devices;
- the RV64 program runs on that target;
- the target has no guest operating system.
Saying “QEMU executed the program” is understandable in informal language, but the more useful model is that QEMU emulates the machine whose CPU executes the target instructions.
1.2 The ISA connects software and processor
Machine code only has meaning if software and the processor agree on what each instruction means.
This agreement is the Instruction Set Architecture (ISA).
An ISA specifies properties visible to machine-level software, including:
- instructions and their encodings,
- registers,
- memory-addressing rules,
- exceptional control transfers,
- privilege mechanisms.
Different processor implementations can implement the same ISA.
The ISA should therefore be distinguished from the microarchitecture:
- ISA: the contract visible to software;
- microarchitecture: how a particular processor implements that contract internally.
For BVS1, the teaching target uses RV64, the 64-bit form of RISC-V.
1.2.1 Why RV64?
RISC-V is a teaching choice, not a claim that it is the best ISA for every system.
It offers a comparatively regular architecture, public specifications, a modern privilege model, suitable development tools, and a well-supported QEMU virt machine. These properties let us expose operating-system mechanisms without making historical processor complexity the subject of the course.
1.3 Development host and target are different roles
The machine on which software is developed does not need to use the same ISA as the machine for which the program is built.
In BVS1:
- the development host is the Ubuntu
bvs1VM in which the development tools run; - the target is the RV64 machine for which we build the program.
The development VM may itself run on an x86-64 or Arm64 host platform. The teaching target is nevertheless RV64.
This gives two separate questions:
- Where do the development tools execute?
- Which machine will execute the generated program?
Keeping these roles separate will matter when we build code on one machine for another and when we examine emulation.
1.4 Virtualization and emulation are different
The most useful first question is:
Can the physical CPU execute the guest or target instructions directly?
That question separates the roles of virtualization and emulation more clearly than the word virtual machine by itself.
1.4.1 Virtualization: the guest instructions already belong to the host ISA
In hardware-assisted virtualization, guest and host normally use the same processor ISA.
A guest instruction is therefore, in the ordinary case, already an instruction that the physical CPU understands. Most non-privileged guest instructions can execute directly on the physical processor.
The virtualization mechanism controls the parts that must not simply be handed to the guest, for example:
- isolation between machines,
- privileged processor state,
- access to memory and devices,
- transitions that require intervention by the virtualization layer.
A simplified model is:
guest instruction
↓
physical CPU
The important point is not that virtualization performs no mediation. It is that the guest machine does not require a different instruction vocabulary from the physical CPU.
In BVS1, Multipass manages the Ubuntu development VM using virtualization facilities available on the host platform. The exact backend can differ between operating systems.
1.4.2 Emulation: the target instruction may not be a host instruction
Emulation can reproduce a machine whose ISA differs from the host ISA.
Suppose the physical processor uses x86-64 while the BVS1 target uses RV64. The physical x86-64 CPU does not directly understand an RV64 instruction.
An emulator must therefore reproduce the effect of the target instruction. Conceptually:
RV64 target instruction
↓
QEMU
↓
interpret / translate
↓
host operations
↓
physical CPU
The word interpret is useful for the conceptual distinction, but it should not be understood as a claim that an emulator must process every instruction individually. QEMU can dynamically translate blocks of target instructions into host code.
The essential point is:
Virtualization can largely run guest instructions directly; emulation must reproduce what target instructions would do when the host cannot execute them directly.
1.4.3 Our BVS1 machine stack
The resulting stack is:
physical host
↓ virtualization (managed through Multipass)
Ubuntu development VM: bvs1
↓ runs
QEMU
↓ emulates RV64
RV64 target machine
↓ executes
Hello BVS1
The layers have different roles:
- the physical host provides the real CPU, memory and devices;
- the Ubuntu development VM is the common environment in which the course tools run;
- Multipass manages that development VM and is not an additional machine layer;
- QEMU runs as a normal program inside the development VM;
- QEMU emulates the RV64 target machine;
Hello BVS1executes on that target.
Only the RV64 target is the teaching machine whose operating-system mechanisms we will build. It initially contains no guest operating system.
A virtual machine is the machine environment presented to software. Virtualization and emulation are different techniques that can provide such environments.
QEMU itself is capable of more than the configuration used here: in other settings it can also participate in hardware-assisted virtualization. In BVS1, its relevant role is RV64 emulation.
1.5 The toolchain connects development host and target
The source program is written in a human-readable programming language, but the target CPU needs RV64 machine instructions.
The toolchain is the set of cooperating build tools. The compiler and assembler translate source into target machine code. They produce object files: target-specific intermediate files that still need to be combined. The linker combines those objects and resolves references between them.
These build products use ELF (Executable and Linkable Format), a binary format used here for both object files and the final executable.
A simplified build path is:
source code
↓
cross compiler / assembler
↓
object files
↓
linker
↓
RV64 executable
↓
QEMU
↓
RV64 target machine
A cross compiler runs on one architecture while producing code for another target architecture. This is cross-compilation.
QEMU has a different role: it does not translate source code into the executable. It provides the machine on which the already generated target program can run.
1.5.1 Object files are not yet the complete program
Compilation and assembly can already produce target-specific object files. These can contain RV64 machine code, but they are not yet the complete executable. Separate pieces still have to be combined and references between them resolved.
The final result of this build path is a linked RV64 ELF executable that QEMU can load for the target machine.
Lecture 2 unfolds this path manually: we inspect the object files, discover what is still unresolved, and then see why linking and the target memory layout are necessary.
1.6 When does an operating system become useful?
The Hello BVS1 target can run one tiny program without a guest operating system.
Now change the requirement:
The machine must run two programs.
New questions immediately appear:
- Which program receives the processor?
- Where is each program’s state kept?
- What happens when one program waits for a device?
- Can one program overwrite another program’s memory?
- Who coordinates access to shared devices?
- How does a program request a shared service?
Increase the requirements further:
- many programs,
- multiple users,
- persistent storage,
- keyboard and display,
- networking,
- failures,
- programs that do not trust one another.
The problem is no longer merely “execute instructions”.
Now the system needs mechanisms for sharing, coordination, protection and abstraction.
This gives us the working definition used in BVS1:
An operating system is software that helps turn hardware into a usable computer system by providing abstractions, resource management, coordination, protection, and services for programs and users.
This is intentionally a working definition.
We will test and sharpen it as concrete mechanisms are introduced.
Two classical viewpoints are already visible:
Operating system as resource manager
CPU time, memory, storage and devices are finite resources that must be shared and controlled.Operating system as abstract machine
Programs should not need to manipulate every hardware detail directly. The operating system can provide safer and more useful abstractions and services.
1.7 Applying the working definition
The opening lecture deliberately asks students to classify several familiar terms before the working definition is established.
After deriving the definition, the distinctions become clearer:
- Windows, Ubuntu and Android are complete operating-system environments.
- The Linux kernel is the core used by Linux-based operating-system environments, not such an environment by itself.
- UEFI is firmware and a firmware interface/environment.
- QEMU is an emulator and virtualizer.
- Docker provides container tooling built on operating-system mechanisms.
- Firefox is an application.
The purpose of the exercise is not to memorize labels.
It is to ask which responsibilities a component actually assumes and at which layer it operates.
1.8 From Hello BVS1 to a minimal operating system
The course deliberately starts with a target that can do very little:
Hello BVS1
The semester question is:
What must we add to Hello BVS1 before we would call the result an operating system?
Initial answers may include:
- handling devices,
- multiple executions,
- scheduling,
- protection,
- memory management,
- system services,
- communication,
- persistent storage,
- users,
- a command interface.
At the beginning these are hypotheses, not a checklist to memorize.
We add mechanisms only when a new requirement gives us a reason for them.
The practical target remains:
a small educational operating system on RV64 and QEMU
virt, eventually providing a simple shell
The red thread is:
a machine executes code
↓
software communicates with devices
↓
events must be handled
↓
multiple programs must coexist
↓
programs compete for the CPU
↓
programs and resources need protection
↓
programs need operating-system services
↓
programs need coordination
↓
programs need communication
↓
a user needs to control programs
↓
a simple shell
The course is therefore not organized as a catalogue of terminology.
Each new mechanism should answer a problem that the current system has acquired.
1.9 Key ideas
Lecture 1 establishes a small number of distinctions that we will use repeatedly:
- A target processor can execute a program without a guest operating system.
- CPU, memory and devices exist independently of the OS.
- An ISA defines the machine-level contract on which software relies.
- Development host and target are different roles.
- Virtualization and emulation are different techniques.
- Multipass gives us the virtualized development environment; QEMU emulates our RV64 target in the BVS1 setup.
- A cross-toolchain produces machine code for a target ISA different from the development system.
- Operating systems become useful as requirements for sharing, abstraction, coordination, protection and services grow.
- The BVS1 system grows only when a new requirement motivates a new mechanism.
A useful test of understanding is to explain this complete path:
source code
↓
cross-toolchain
↓
RV64 executable
↓
QEMU program in the development VM
↓
emulated RV64 machine
↓
observable program behaviour
and then explain why successful execution still does not imply that the target contains an operating system.
References
- Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces. https://pages.cs.wisc.edu/~remzi/OSTEP/
- Andrew S. Tanenbaum and Herbert Bos, Modern Operating Systems, 5th ed., Pearson, 2023. ISBN 978-0-13-761888-0. https://www.pearson.com/en-us/subject-catalog/p/modern-operating-systems/P200000003295/9780137618880
- RISC-V International, RISC-V Ratified Specifications Library. https://docs.riscv.org/
- QEMU Project, RISC-V
virtGeneric Virtual Platform. https://www.qemu.org/docs/master/system/riscv/virt.html - Canonical, Multipass Documentation. https://documentation.ubuntu.com/multipass/