Mirage is an exokernel for constructing secure, high-performance network applications across a variety of cloud computing and mobile platforms. Code can be developed on a normal OS such as Linux or MacOS X, and then compiled into a fully-standalone, specialised microkernel that runs under the Xen hypervisor. Since Xen powers most public cloud computing infrastructure such as Amazon EC2, this lets your servers run more cheaply, securely and finer control than with a full software stack.

Mirage is based around the OCaml language, with syntax extensions and libraries which provide networking, storage and concurrency support that are easy to use during development, and map directly into operating system constructs when being compiled for production deployment. The framework is fully event-driven, with no support for preemptive threading.

Mirage is still in pre-alpha stage, but the infrastructure you see here is self-hosting. Check out the wiki for an installation guide, compile your hello world microkernel, get started with the public cloud, or watch the talk and read the papers.

let echo () =
  lwt mgr, mgr_t = Manager.create () in
  let src = None, 8081 in 
  Flow.listen mgr (`TCPv4 (src,
    (fun (addr, port) t ->
       Console.log "From %s:%d" (ipv4_addr_to_string addr) port;
       let rec echo () =
         lwt res = Flow.read t in
         match res with
         |None ->
            Console.log "Connection closed";
            return ()
         |Some data ->
            Flow.write t data >>= echo
       in
       echo ()
    )
  ))