Version 4 (modified by Martin Decky, 10 years ago) ( diff )

development and debugging

What is HelenOS

HelenOS is a portable general-purpose operating system designed and implemented from scratch. It is based on microkernel multiserver design principles. This means that the kernel of the system has relatively limited responsibilities (mostly just memory and resource management, scheduling of threads and facilitating communication between user space tasks) and most of the core system functionality is implemented in user space (including for example device and file system drivers). The core system functionality is decomposed into individual, isolated, intensively communicating and mostly simple user space tasks. This orthogonal decomposition of concerns follows the concepts of component-based software engineering.

The HelenOS project has been in constant development since 2005 (with earlier prototypes even predating its official inception), but the development team is rather small and its manpower is limited. Therefore HelenOS is still not a drop-in replacement for mature operating systems such as GNU/Linux. It simply lacks some end-user features of a desktop operating systems. But it is an excellent research, experimenting and prototyping tool, also thanks to a well-documented and readable code. Over the years, many contributions to HelenOS were done by university students in the context of their bachelor/master theses or programs such as Google Summer of Code and ESA Summer of Code in Space. This also demonstrates the friendly learning curve of HelenOS.

As for the features, HelenOS currently supports 7 hardware architectures (in most cases on actual hardware, not just in emulators) from a single portable code base. HelenOS has support for SMP, textual and graphical user interface (a composing window manager), IPv4 and IPv6 networking (including drivers for several ethernet cards), USB bus and USB devices, PATA and SATA disk drives, sound (including drivers for Sound Blaster 16 and Intel HD Audio) and more.

This is a brief step-by-step tutorial for running HelenOS in QEMU and experiencing some of its features. There is also a more comprehensive guide and an entire wiki with various user and developer resources.

How to Run HelenOS in QEMU

Assuming you have downloaded the x86-64 ISO image called HelenOS-0.6.0-rc3-amd64.iso, you can use the following QEMU command line to run it:

qemu-system-x86_64 -device e1000,vlan=0 -net user -redir tcp:2223::2223 -redir tcp:8080::8080 -usb -device intel-hda -device hda-duplex -boot d -cdrom HelenOS-0.6.0-rc3-amd64.iso

If you know what you are doing, you can also extend the QEMU command with the following arguments:

  • -m <size>
    • You can configure more emulated physical memory for HelenOS to use.
  • --enable-kvm
    • If your host x86-64 machine has support for hardware virtualization, you can enable it and make HelenOS run faster.
  • -smp <count>
    • You can enable multiple virtual CPUs in QEMU. However, please note that without hardware virtualization, this will not speed up the execution of HelenOS in the emulator.
  • -hda <disk_image>
    • You can attach a disk image to QEMU and then access it from within HelenOS.
  • -usbdevice host:<bus>.<addr>
    • You can delegate a USB device connected to your host machine to HelenOS running in QEMU.

For more details (such as running different ports than x86-64 in QEMU or configuring bridged networking), please follow the user's guide.

The Boot Process

HelenOS for x86-64 uses the GRUB boot loader to boot the kernel and a few initial user space tasks that are required to bring the system up. A RAM disk containing the root file system is also loaded by GRUB. During HelenOS bootstrap you can see some log entries, either from the kernel or from the user space tasks as they are started and initialized. After a while the user space GUI compositor should take over the screen and you should see three windows. At that time, there are more than 35 user space tasks already running in the system and providing its functionality.

The First Steps

The window titled vterm is a terminal window where you can run commands via a command line. The terminal window is running a bdsh (Brain Dead Shell, named so because of its simplicity). The vlaunch window demonstrates some other widgets of our GUI framework and it also allows you to run another instance of vterm. The untitled window in the right-bottom corner of the screen is a simple liveness indicator.

The GUI is rather simple, but it supports the common window manipulations using the mouse. You can move the windows around by dragging the window title, you can switch window focus by clicking on them, etc. But the GUI is more capable than just that. It uses a composing desktop and therefore you can use the following hot-keys to manipulate the focused window in more fancy ways:

Key Action
Alt + Q, Alt + E Rotate window (clockwise, counter-clockwise)
Alt + C, Alt + V Window opacity (more transparent, more opaque)

Once you get bored by this, just run tetris from the terminal window. This should make you occupied for some time.

The shell supports some basic commands you are likely familiar with: ls, cat, cd, pwd, cp, mv, rm, mkdir, echo, etc. If you get totally lost, just run the help command to give you some hints. You can use help commands to list the internal commands of the shell and help help to get more information on how the help system works. The shell provides commands history (Up and Down keys) and clipboard integration (Shift + Left and Shift + Right keys to select, Ctrl + C and Ctrl + V to copy and paste).

There is also support for different keyboard layouts. You can switch between three sample layouts using:

Key Layout
Ctrl + F2 US Dvorak
Ctrl + F3 Czech QWERTZ

Cool Stuff

A brief list of quick and interesting things to do in HelenOS. We assume you have used the suggested QEMU command line, otherwise your mileage may vary. Just run these commands in the terminal window:

  • ping
    • Ping the localhost.
  • ping
    • Ping the QEMU virtual gateway.
  • dnsres
    • Try to resolve the IP address of You can use the arguments -4 and -6 to specifically ask for an IPv4 or IPv6 address.
  • websrv -p 8080
    • Start a web server on port 8080. You can then type the URL http://localhost:8080 in your browser in your host system and see what happens.
  • wavplay demo.wav
    • Play a sample sound file.
  • modplay demo.xm
    • Play an XM module file. The pitch of some of the notes is not correct because the player does not implement all the FastTracker II effects yet.
  • edit demo.txt
    • Run a simple text editor to edit some UTF-8 text file. The entire system uses UTF-8 to store character strings and texts, although the terminal font does not support all Unicode glyphs.
  • loc
    • Display the location service entries (mostly hardware devices).
  • nic
    • Display network interface cards.
  • usbinfo --list
    • Display connected USB devices.
  • top
    • Display current running tasks, CPU and memory utilization and other system statistics.
  • tetris
    • Play tetris.

Advanced: Development and Testing

Because of the ongoing development, HelenOS changes rapidly and needs to be tested and debugged. For the most fundamental debugging you can switch to the kernel console using the kcon command. Note that the kernel console brutally violate the microkernel design principles, but it was never meant to be part of a production system. It is just a debugging tool. Also note that the user space is not aware of the kernel console and therefore the user space graphic output might sometimes overwrite the kernel output.

You can use the Page Up and Page Down keys to scroll back in the kernel console output. Some of the more commonly used commands of the kernel console are:

  • help
    • Print all kernel console commands.
  • continue
    • Leave the kernel console and enable the user space input/output again.
  • tasks
    • List the tasks running in the system.
  • ipc <taskid>
    • Print the information about the communication between the given task and other tasks.
  • threads
    • Print the threads running in the system.
  • physmem and zones
    • Display the physical memory map and usage.
  • slabs
    • Print the kernel virtual memory statistics.
  • test
    • Run kernel tests.
  • btrace <threadid>
    • Print a stack trace of the given thread.

There are also user space testing and debugging means. You can examine the following commands:

  • stats
    • Print the running tasks.
  • trace
    • Trace the execution of a task. You can examine thread creation/termination, kernel syscalls and task communication (either on the level of basic messages or on the protocol level).
  • taskdump
    • Create a core dump of a task for later examination. A core dump is also created automatically if a task crashes.
  • tester
    • Run tests that test various parts of the HelenOS system.
  • redir
    • Redirect the standard/error output of a task to a file for later examination.
Note: See TracWiki for help on using the wiki.