News for hackers. Stuff that matters.
Re:My First Unikernel by enduser on Wednesday July 30, 2014 @02:03PM (#8109912)
If it helps to add clarity to what this is about, Xen still requires a host (dom0) operating system, usually Linux but also NetBSD and OpenSolaris. Mirage OS (the basis for building your own unikernel) allows building applications as domU kernels. This is advantageous because it minimizes context-switching and allows all of the code in a Xen VM (domU) to be written in a safer language than C.

So the dom0 OS (Linux) still determines which devices are exposed to the Unikernel. The Unikernel implementation is simple relative to a full "bare metal" OS because it only needs to support the Xen interfaces to block devices, the network, etc., and does not have to deal with disk drives, ethernet controllers, etc.

If you are running your own hardware, you're probably better off using something like FreeBSD + Jails or Linux + LXC (Docker). The Unikernel approach is more appropriate for situations where you want to deploy applications on Xen-based cloud infrastructure (Amazon EC2, Rackspace Cloud Servers) and do not want to waste resources or increase security risk by running a full OS. The physical servers at Amazon and Rackspace are already running a full dom0 OS (probably Linux), so running another full OS on top of that just to run your app is inefficient.

Re:My First Unikernel by amirmc on Wednesday July 30, 2014 @03:56PM (#8110548)
Even if you have your own hardware there are scenarios where you might want stronger isolation, increased density and/or heterogeneous deployments. All of which is achievable with Unikernels running on Xen.
Re:My First Unikernel by mwcampbell on Wednesday July 30, 2014 @04:04PM (#8110602)
How would unikernels running on Xen give you better density than containers (which are really just namespaced processes) running on a shared Unix kernel on bare metal? Wouldn't the Xen-based approach have more overhead?
Re:My First Unikernel by avsm on Wednesday July 30, 2014 @05:11PM (#8110999)
This isn't supported yet, but unikernels on Xen don't currently switch address spaces (cr2 on x86). We're thinking about how to increase density by supporting process switching on Xen, which isn't hard, but needs to be done carefully.

Xen also supports memory sharing among VMs if running in a hardware container, and Hwanju Kim added support for "PVH" mode to MiniOS recently which unlocks this functionality in Mirage. Early days on this work, but fun ones, since we aren't bound by the compatibility constraints of Linux containers, but have access to the same hardware resources.

Re:My First Unikernel by nimish on Thursday July 31, 2014 @04:07AM (#8112962)
Sure but then I'm limited to OCaML and have to run in kernel mode when developing apps.

Occasionally a good tradeoff, but a significant one.

Re:My First Unikernel by amirmc on Thursday July 31, 2014 @06:48AM (#8113361)
There are other approaches that yield Unikernels [1]. I don't quite understand your point about kernel mode and why that would be a problem under this scenario. The code is your own and you only use the OS components you require. The ASPLOS article has more detail on the approach and trade-offs [2].

[1] see table 2 at http://queue.acm.org/detail.cfm?id=2566628

[2] http://anil.recoil.org/papers/2013-asplos-mirage.pdf

Re:My First Unikernel by nimish on Thursday July 31, 2014 @01:01PM (#8115347)
Debugging kernel mode code is painful, in general, even on a VM
Re:My First Unikernel by amirmc on Thursday July 31, 2014 @03:15PM (#8116320)
Perhaps I'm wrong but I feel you've either (1) missed the point or (2) haven't actually looked at the references. Everything is written in a high-level language and the VM is an artefact produced as a result of the process (you don't debug on the VM, you debug the code that generated it).
Re:My First Unikernel by nimish on Wednesday August 06, 2014 @01:39PM (#8143717)
Sure and then when production errors happen I'm left with having to deal with debugging a VM process rather than a User mode process :)

Enough can go wrong in the packaging and distribution that it's a real risk.

At the end of the unikernel generation pipeline I get a little Xen VM spit out that I can run. How do I debug this guy? It's running on a hypervisor but is essentially in a different environment. I'd love to be able to take code written in one environment and be 100% sure it'd work in another, but that ain't going to happen soon.

Re:My First Unikernel by frik on Wednesday July 30, 2014 @04:04PM (#8110603)
Even though Amazon EC2 is Xen-based (internally), you have to run a lightweight Linux distro to use Mirage on AWS EC2 (at least for now), as I learned from the MirageOS posting a few weeks ago.
Re:My First Unikernel by avsm on Wednesday July 30, 2014 @05:07PM (#8110966)
(mirage dev here)

Not true -- you can run Mirage Xen kernels directly as EC2 guest VMs by using their AKI feature to boot a custom kernel. Instead of a custom Linux kernel, just boot a unikernel and don't bother with user space :-)

Go to http://github.com/mirage/mirage and check out scripts/ec2.sh for a shell script that automates this (needs to be more user friendly, patches welcome)