Currently, virtual machines in the cloud typically run existing general-purpose operating systems, such as Linux, on top of the cloud's hypervisor kernel. The cloud’s hypervisor already provides some features, such as isolation and hardware abstraction, which are duplicated by traditional operating systems (in this case Linux), and that this duplication comes at a cost. OSv aims to replace Linux by addressing the duplication issues by using a low-overhead library-OS-like design.
In the current model on the left, system calls need to go through the JVM, Linux kernel, and Hypervisor kernel. This is inefficient, and the OSv model on the right aims to make it simpler and faster.
Goals of OSv:
- Run Linux apps (although not all)
- Faster (app performance)
- Faster boot time (instead of fork/exec, use VM)
- Use C++11 (atomic synchronization)
The library OS seeks to achieve the following:
- Every app gets its own virtual machine
- Every app has its own copy of the library (often shared in practice, for performance reasons)
- Every app has its own address space
What we need to build OSv:
- Loader (loads OSv, JVM, etc.)
- Dynamic linker (builds apps not in C++)
- Memory management (new/malloc)
- Thread scheduler
- Synchronization
- Drivers (hook up app to the files hypervisor has control of)
For performance, OSv avoids spinlocks. Spinlocks cause a lock-holder preemption problem. Instead, OSv uses lock-free algorithms by utilizing the atomic operations C++11 provides for accessing shared memory.
In Linux, an application knows that a packet for it is received by using the Linux socket mechanism. This mechanism is considered inefficient for OSv. The application must copy data from system space to user space after it has been received through the network. OSv avoids that by using a dedicated thread for receiving and sending packets. The use of this new mechanism is not enforced, however, because OSv still wants Linux applications to be able to run.
The dedicated thread for receiving and sending packets can run lockless. However, it doesn't provide the LInux/POSIX API! Applications will need to be written differently to accomodate the new API provided by OSv.
OSv also runs tickless. Instead of interrupting each thread at set intervals, OSv uses hardware timers on a per thread basis to cut down on interrupts per second. However, the paper notes that OSv still has to interrupt threads sometimes to deal with specific types of hardware.
OSv only works with JVM-like apps. The idea behind OSv is to modify JVM to use these new socket APIs more effectively. It is designed to run existing Java apps on top of a modified JVM. However, doing so limits OSv to the Java world as only Java apps can run on OSv.
ClickOS is another OS that does not use system calls, developed by Kohler in 2008. This type of operating system has not succeeded yet, but if it does, it could change the way operating systems work with system calls.