Projet Système

The Projet Système is an x86 kernel project created by Ensimag for its students. The aim of the project is, for a group of 2 or 3 students, to build a small x86 kernel in one month. The kernel has to fit some requirements defined by a precise specification. Usually it must at least provide a priority based scheduler with processes, interruptions/exceptions management and a user space (use of privilege levels). I’ve been involved in this project since 2010, first as a student and now as a teacher. This page describes my work as a student, and as a teacher.

The official project web page is available here (in French).

Note: The project is presented here with a global point of view. Indeed, the same project subject is reused each year and this page must not be a all-in-one solution. So you won’t find source code or implementations. If you want more information, feel free to contact me.

As a student …

I worked on this project with a friend, Gaëtan Morin, when we were students at Ensimag (M1 level) in 2010. We implemented the kernel, a set of system calls and some user space application to run above. the official webpage of our project is available here (in French).

Kernel implementation

The kernel booted in VGA mode (80×25) with a running shell.

      • Processes managed by a FIFO based scheduler, all running in the same address space (CPU time sharing, creation/termination/kill, priority management, blocking calls, etc)
      • Message queue between processes
      • Hardware management :
        • PS2 (mouse/keyboard) driver
        • VGA text driver (80×25 characters)
        • VESA graphic driver (up to a resolution of 1280x1024x32bits) that uses linear framebuffer mode
        • System beeper driver

Interruptions (timer, keyboard, mouse) and exceptions (div by 0, pgfautl, gpfault) management

Kernel booted in VESA mode (1024x768x24) with the same shell running.

In user space …

During the project we developed a set of applications to use our kernel’s features, such as graphic display. These applications were using system calls implemented by the kernel to manage processes, and use the hardware. Here is an overview of these apps:

      • A shell to launch applications, with background tasks management.
      • A set of commands to manage processes (ps, kill) and message queues (pcreate, psend, preceive, etc).
      • A display server with the associated window manager to make use of the available VESA framebuffer. Both of them managed composition with transparency, and mouse display.
      • A picture viewer

A draw application

The kernel in VESA mode (1024x768x24) running the window manager and some apps.

Run it !

You can try the kernel using Qemu (with or without KVM) and the kernel binary. Download the kernel binary here, uncompress it and run it with Qemu. More simply:

$ cd /tmp
$ wget http://ensiwiki.ensimag.fr/images/c/c5/Kernel.bin.gz
$ gzip -d Kernel.bin.gz
$ qemu-system-i386 -kernel Kernel.bin -m 128

Then press “i” to skip the debug screen, you’re now in the shell. Type “startwm” and then Enter to run the window manager. You’re in ! Please note that all graphic operations are done by the CPU so it’ll run faster if you use virtualization (ie Qemu+KVM) and not only emulation.

As a teacher …

The teaching side

After this experience as student I wanted to contribute to the project as a teacher. For two years (2012, 2013) I’m part of the teachers’ team that lead students during the project. Each year, I’m dedicating five days spread up on a month. During these days I’m not working for my employer, but for the Ensimag as a casual worker.

We’re in charge of leading and helping students on technical aspects of the projects (possible implementations, how to debug efficiently, etc). We’re 2 or 3 teachers to ensure a duty period each weeks for a group of 20 to 40 students. Each teacher is especially in charge of 10/12 of them for the final evaluation.

Pages of project results for the two years (in French, with pictures :D): 2012, 2013.

My contribution

Between 2012 and 2013 we decided to add another requirement to the mandatory part of the project: a memory isolation between processes using paging/virtual memory. But it seemed impossible because the set of tools and concepts to learn, giving the actual state of the project skeleton, was too big for a student in one month. We decided to rework the whole project to include this new feature, it implied:

  • Introduce the concept of loadable application without filesystem or ELF parsing,
  • Grow the initial memory space to give to the kernel a consequent set of available hardware frames,
  • Suggest an API for a simple memory sharing between processes,
  • Add tests to validate memory isolation, paging and memory sharing in the existing test suite.

I finally reworked the whole project to introduce the new toolchain, the tests and I reimplemented it as a student, following the requirements, to check correctness. It was a lot of work, but it was really exciting and I learn a lot !