Hacker News new | past | comments | ask | show | jobs | submit login
Mirage v2.0: a recap of the new features (openmirage.org)
53 points by mrry on July 22, 2014 | hide | past | favorite | 12 comments

For the uninitiated, Anil (@avsm) recently gave a fantastic interview about Mirage, its goals and the OCaml language on the Software Engineering radio [0]. Its around a hour long and extremely informative (and technical). It piqued my curiosity enough to learn OCaml. Highly recommended.

[0] - http://www.se-radio.net/2014/05/episode-204-anil-madhavapedd...

Is it possible that there might be other syntaxes with the same semantics or semantics described in OCaml that could be translated into OCaml and then compiled to unikernels?

Stupid questions: does Mirage OS allow me to run C or Python programs? Can I run bash or Xwindows or do OpenGL?

While correct, I always find the declaration of Mirage (and HaLVM for that matter) as an OS to be unhelpful. It is a cross compiler for OCaml (resp. Haskell) to the Xen ABI along with libraries for interacting with Xen primitives (inter-domain communication, etc).

Mirage is actually not just the Xen ABI. It includes a frontend that swaps in appropriate implementations of module signatures for other backends.

For instance, Andy Ray just got a kernel module target working: http://lists.xenproject.org/archives/html/mirageos-devel/201... (when this mode is complete, the network stack module will call directly into the FreeBSD kthread rather than invoking socket syscalls, for example). This is also how we plan to support the Raspberry Pi (use FreeBSD as a bootloader, with just one kernel thread running which runs the unikernel).

And there are also ongoing ports to JavaScript (to work as an IOCaml notebook, which is itself based on IPython).

All of these just need a recompilation with a different invocation of `mirage configure --<target>`.

I follow you work with great interest.

I had the fortune of using Oberon/Blue Bottle in the 90's and also some contact with Singularity.

So I am very passionate about OS done in memory safe languages and alternative OS designs outside the UNIX System V model.

Congratulations for the work achieved.

Today. Nothing prevents a future version to target hardware directly.

It has been mentioned multiple times that Xen ABI is just away of saving resources to focus on more important areas for the time being.

So what if you dont know / use OCaml?

Well, it's always fun to learn a new language, especially one with the 20 year provenance of OCaml! The modularity features that OCaml provides are really key to the core of Mirage. I'd suggest starting with:

* OCaml from the very beginning: http://ocaml-book.com/

* Real World OCaml (shameless plug: author). Freely available online: https://realworldocaml.org

* The OCaml.org website itself: http://ocaml.org/learn/ (99 problems is really fun).

Mirage does of course offer an FFI to interface with C libraries, although the majority of the hacking efforts are geared towards filling in gaps in the pure OCaml library ecosystem. See the FFI blog post for more on this (you can even bind to C libraries interactively using the `utop` REPL with ctypes): http://openmirage.org/blog/modular-foreign-function-bindings

Mirage is as much about the security and efficiency of using static typing through the OS stack, as it is about exploring the concept of unikernels. There are other efforts more into compatibility with existing applications (like OSv) that you might want to look into for running an existing stack. But I encourage you to experiment with thinking and trying the Mirage style of unikernel assembly, and report back with where it works and the areas where it could improve!

Others have written more eloquently than me about why you should bother learning OCaml:

* Esper: http://tech.esper.com/2014/07/15/why-we-use-ocaml/

* Thomas Leonard's Python to OCaml retrospective: http://roscidus.com/blog/blog/2014/06/06/python-to-ocaml-ret... (Thomas also leads the Mirage ARM port work)

* Yaron Minsky's OCaml for the Masses: http://queue.acm.org/detail.cfm?id=2038036

About the "Python to OCaml", the result is only 10% faster?

Nothing wrong with that but some of the most frequent arguments against Python are related to execution speed, I would expect a bigger difference here.

10x faster*

FTA: "The new code is a similar length (slightly shorter), runs around 10x faster, and is statically type checked."

Ouch, I need to schedule an optician to check my glasses prescription. %-)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact