3 ms·
A user process running on an OS running on a hypervisor has certain overhead, so you can either remove the hypervisor (native containers) or you can remove the
by wmf 9y ago
A user process running on an OS running on a hypervisor has certain overhead, so you can either remove the hypervisor (native containers) or you can remove the OS (unikernels). Arguably the hypervisor has a smaller attack surface than an OS.
Also, there's a small set of programs that don't get along with the abstractions provided by OSes and run better on a virtual hardware abstraction instead.
- first_amendment 9y agoUnfortunately containers aren't considered secure enough for malicious users while VMs are.
- AstralStorm 9y agoNeither are most unikernels. Especially the weak points are file system and network handling. Generally the security of VMs is enforced by hardware and improved by limited attack surface - few drivers to audit, limited communication APIs. You can do the same with general purpose OS by cutting options.
- first_amendment 9y agoI'm not talking about unikernels. I'm talking about the VMs that isolate them from each other. The VM isolation mechanism is considered secure enough to isolate malicious users, while the container isolation mechanism isn't (at least Linux-based containers).
- cyphar 9y agoSolaris/illumos Zones and FreeBSD Jails most definitely are considered secure for malicious users. And they've been secure for more than a few years.
- amscanne 9y agoYou realize that the guest OS _does_ things right? It's not just overhead. You can't just remove the Linux network stack, you have to replace it with something. (And the Linux network stack is pretty damned good at what it does.) The intrinsic overhead of the OS (i.e. costs of mode switching) is much smaller than you might think. It's true that some programs don't really want an OS getting in their way, but a modern operating system provide decent facilities for getting _out_ of the way (e.g. O_DIRECT for block I/O, pinning tasks to cores) and that's usually what those things use.
- amluto 9y agoThis is backwards. A userspace process on x86 has a certain amount of overhead, namely the overhead needed to switch between it and the host kernel. This takes the form of SYSCALL/SYSRET (mostly) for system calls and interrupts/IRET (mostly) for interrupt returns. SYSCALL and SYSRET are quite fast. interrupts and IRET are slow. A VM guest needs to do a VM exit (which is quite a bit slower than even an interrupt, I believe) and then fix up a bunch of host state that doesn't get restored by the CPU. Then, to get back to guest mode, it needs to manually restore some guest state and do VMRESUME. Regular user mode wins hands down. To be fair, unikernels get to directly create page tables, which is potentially very useful. But, for the simpler applications, it's probably not. (I more or less maintain the glue between x86 Linux user code and the kernel. I do, in fact, know exactly how this works.)
- wmf 9y agoThe number of calls probably wouldn't be the same, though. A process might make hundreds of system calls while a unikernel might make one hypercall to do the same work (because virtio has batching). Anyway, I don't personally think reducing system call overhead is interesting but it seems to be one of the arguments unikernel people make.
- amluto 9y agoI see no reason whatsoever that you can't do virtio without virtualization.