nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.27k stars 132 forks source link

What are the benefits of using `ops` over linux kernel with a single binary? #1348

Closed xphoniex closed 2 years ago

xphoniex commented 2 years ago

Hope I'm not posting this in the wrong place. I'm new to unikernels and ops is the best tooling I've found.

Choice of using nanos kernel seems like a double-edge sword, on one hand it allows you to implement things in a more efficient way and on the other hand, it's not Linux, meaning there's a chance it might not produce the same result as Linux (which is pretty stable).

I understand the benefits of being able to call into kernel directly and bypassing networking stack (less memcpy, faster processing, etc), what else do I get if I ditch a linux kernel + binary as PID 1 solution? If I only have a single binary running, then I won't be suffering from context switches, etc.

I'd appreciate your input as I'm not a kernel expert.

eyberg commented 2 years ago

you're right - this is probably better on the 'discussion' tab or on the forums but no worries

first off; we still have a kernel<>user switch but we don't have process<>process switches - there are a few types of switches depending on the context and they each impose their own perf. tax

there is a lot of stuff that linux does that we simply won't support ever - things like users and associated permissions, interactivity that you would find in a comparable linux system; the ability to run multiple processes - a lot of this is more entertwined than you would think it is; for instance the scheduler now has to be aware of priorities amongst processes and the way they can communicate (via say shared memory or signaling) imposes a lot of different constraints as well

in short even if you have alpine with a heavy seccomp profile you still aren't really going to get apples to apples; there are a lot of other interesting things you can do once you have this architecture