4 ms·
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 (t
by enduser 12y ago
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.
- amirmc 12y agoEven 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.
- mwcampbell 12y agoHow 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?
- avsm 12y agoThis 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.
- nimish 12y agoSure 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.
- amirmc 12y agoThere 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 http://queue.acm.org/detail.cfm?id=2566628 [2] http://anil.recoil.org/papers/2013-asplos-mirage.pdf http://anil.recoil.org/papers/2013-asplos-mirage.pdf
- nimish 12y agoDebugging kernel mode code is painful, in general, even on a VM
- amirmc 12y agoPerhaps 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).
- nimish 12y agoSure 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.
- frik 12y agoEven 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.
- avsm 12y ago(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 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)