BSDCan2009 - Final Release

BSDCan 2009
The Technical BSD Conference

Antti Kantee
Day Talks - 2 - 2009-05-09
Room MNT 202
Start time 16:00
Duration 01:00
ID 134
Event type Lecture
Track Hacking
Language used for presentation English

Kernel Development in Userspace

The Application Approach

Kernel development is always a challenge. Testing cannot efficiently be performed on the same host as development, as a crash would disrupt the development effort. Instead of performing testing on the development host, multiple classic ways of making testing and debugging less tedious are available. An emulator or usermode OS can be used for testing without requiring a full machine. However, triggering some code paths might be tedious, since the integrity of the entire operating system must be preserved or a crash in non-relevant code will bring the entire development operation to a halt. A much more surgical approach is to do algorithm development as a userspace application. However, this means rewriting parts
of the kernel functionality to use userspace interfaces.

We argue that often the best approach for kernel development is using the kernel as a userspace application library. This brings the benefits of being able to very precisely control what parts of the code are being executed while still preserving the use of kernel interfaces. The implementation under test remains isolated from the host OS in the sense of an application process, so errors cannot bring the development host down.

This talk explains the NetBSD Runnable Userspace Meta Program (rump) framework and its uses for kernel development. We will go over what kind of kernel development it is suitable for and what not. We also examine the requirements for running the kernel as an application library. Examples from file systems, the networking stack and generic kernel algorithms will be presented.