• Chroot
  • FreeBSD Jails
  • VM Ware
  • Containers

What is an OS?

ENTER

THE UNIKERNEL

Cool things about that...

  • Fast boot
  • Optimized
  • Tiny footprint
  • Lower attack surface area
  • 12-factor-app-ness

The Twelve Factors

  1. One codebase tracked in revision control, many deploys
  2. Explicitly declare and isolate dependencies
  3. Store config in the environment
  4. Treat backing services as attached resources
  5. Strictly separate build and run stages
  6. Execute the app as one or more stateless processes
  7. Export services via port binding
  8. Scale out via the process model
  9. Maximize robustness with fast startup and graceful shutdown
  10. Keep development, staging, and production as similar as possible
  11. Treat logs as event streams
  12. Run admin/management tasks as one-off processes

Erlang on Xen

#include <os>
#include <net/inet4>
#include <math.h>
#include <iostream>
#include <sstream>
#include <net/dhcp/dh4client.hpp>

using namespace std::chrono;

std::unique_ptr<net::Inet4<VirtioNet> > inet;

void Service::start() {
  Nic<VirtioNet>& eth0 = Dev::eth<0,VirtioNet>();  
  inet = std::make_unique<net::Inet4<VirtioNet> >(eth0);
  inet->network_config( {{ 10,0,0,42 }},      // IP
			{{ 255,255,255,0 }},  // Netmask
			{{ 10,0,0,1 }},       // Gateway
			{{ 8,8,8,8 }} );      // DNS

runtime.js

var runtime = require('runtimejs')
console.log('Hello world!')
# install dependencies
npm install runtimejs
npm install runtimeify -g
npm install runtime-tools -g

# bundle up ramdisk image
runtimeify index.js -o initrd

# make sure you have QEMU installed
brew install qemu           # OSX
sudo apt-get install qemu   # Ubuntu

# run it in QEMU
runtime-qemu ./initr

Rump Kernels

  • NetBSD Drivers: build the software stack you need without forcing you to reinvent the wheels
  • Only a few thousand lines of glue, plus rump kernel components
  • Runs on Xen, KVM, and bare metal.
  • Packages!

Rump Packages

  • erlang
  • haproxy
  • memcached
  • mysql
  • nginx
  • nodejs
  • php
  • redis
  • python3
  • ruby
  • rust
  • sqlite
  • golang
  • ... and more!

July, 2015

Unikernels

By Brian Graham

Unikernels

  • 2,112