Monday, November 03, 2014

Unikernels: Library Operating Systems for the Cloud (OSv)

Unlike a general-purpose, commercial operating system (like Windows, Ubuntu), OSv (http://osv.io/ from cloudius-systems) is a single-purpose operating system. It is also kind of library operating system designed for the cloud that running on top of different hypervisors, e.g. XEN, KVM, VMware. So what does OSv like look? 

By quickly taking a look at this slide (http://www.slideshare.net/dmarti1111/o-sv-usenix-atc-2014), we can get to know these two features below. 
  • General-purpose OS has kernel mode (ring 0) and user mode (ring 3), but OSv only has code running in Ring 0 mode, it doesn't have code running in user (ring 3) mode. This is one of most significant differences.
  • The other main difference is that the OSv only has one single address space (multiple threads allowed, though) running on a hypervisor as being a single virtual appliance, which serves a single-purpose cloud service. 


So, each OSv holds one specific application (with multiple threads) on top of it, and the OSv itself runs as a guest OS on top of hypervisor. Application and resource isolation is guaranteed by the hypervisor.

Since an OSv has a single address space, it needs only one CR3 value. Process and address space switch (scheduler) is not required any more, and hence no TLB flush overhead introduced. This also can reduce "kernel" component memory footprint, and let application own more memory space.

Regarding address translation overheads, e.g. GVA->GPA->HPA, by using the larger table (2MB, or even 1GB) for both guest virtual memory page tables and EPT tables, such a translation overhead could be further reduced a lot. 

Note that, as the slides pointed out, syscalls (user/kernel switch) are no longer required. Any traditional syscalls now are converted to just function calls in kernel mode only. Although this can significantly reduce performance cost, it also causes a new issue: application ABI compatibility issue. This means that in order to deploy this application on top of OSv, the source code must have to be modified and recompiled. 

There are many challenges, you can check http://osv.io/ for greater details. But anyway, if OSv is a correct direction for cloud OS (and with a success on having rich application supported) in future, it will definitely have a direct competition with some other solutions like Docker

I like this product in person, the much simpler it is, the more I love it :-).

Also, see this slide (OSb: OSv on BitVisor), someone is working on enabling OSv on top of BitVisor,  cool ! 



Some other references about Library OS:
----------------------------------------------------
Unikernels: Rise of the Virtual Library Operating System
http://queue.acm.org/detail.cfm?id=2566628

XPDS14: OSv - A Modern Semi-POSIX LibraryOS - Glauber Costa

http://www.xenproject.org/help/presentations-and-videos/video/xpds14v-osv.html

Rethinking the Library OS from the Top Down:

No comments:

Post a Comment