3 ms·
There are, and always will be, performance disadvantages to a microkernel. However, for many many tasks the difference is negligible. X11 has IPC, this has pe
by aidenn0 9y ago
There are, and always will be, performance disadvantages to a microkernel. However, for many many tasks the difference is negligible.
X11 has IPC, this has performance overhead, but nobody seriously suggests that all X11 applications run in the same process.
I work regularly with a microkernel that allows threads (including device driver threads) either in their own separate address space, or in the supervisor address space. The difference in debugability between "there was memory corruption in the kernel" and "there was memory corruptoin in this specific device driver" is huge.
The throughput overhead of message passing versus not on a data-heavy driver tends to be ~20%, though just like IPC in userspace multiprocessing systems you can reduce that somewhat with shared memory, batching and other tricks if needed.
But seriously when people worry about message-passing overhead, I feel like it's 1990 again and we are debating whether the context switch overhead of processes on UNIX is worth it. I'm not sure why the userspace battle was decided so long ago while the kernel debate still goes on.
[edit]
Also sometimes the natural design for a microkernel yields better performance than the natural design for a monlithic kernel. When you are pushing the envelope for performance, sometimes some very counterintuitive things can give you benefits. I have seen cases where a single copy was faster than zero-copy, and cases where the safety of no-shared memory allowed easier parallelization of the work.
- snvzz 9y ago>I feel like it's 1990 again and we are debating whether the context switch overhead of processes on UNIX is worth it. Worth noting are modern (gen2/3, L4 onwards) microkernel context switch costs. This article has a neat table in it. Third page. http://sigops.org/sosp/sosp13/papers/p133-elphinstone.pdf http://sigops.org/sosp/sosp13/papers/p133-elphinstone.pdf In contrast, Linux takes whole microseconds. This should be carefully considered when thinking about multiserver architecture overhead.
- aidenn0 9y agoI'm guessing those are uncontended timings. I haven't been able to think of a good way to do it, but I'd like to see contended timings compared as well. Having a fast fast-path is great for many reasons (a fast fast-path will reduce contention all on its own, and systems can be designed to minimize contention), but the contended case can be much slower on some microkernels, and I have no idea what the overhead is on linux.
- gue5t 9y agoSee this presentation about Google's scheduler patches, which claims the major overhead is logic in the scheduler (pg16): http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1653/original/LPC%20-%20User%20Threading.pdf http://www.linuxplumbersconf.org/2013/ocw/system/presentatio...
- snvzz 9y agoThis is interesting. I wonder what's keeping this kind of work from being mainlined. The present (as shown in the slides) Linux context switch times are painfully long.
- gue5t 9y agoUnless I'm mistaken, Google isn't interested in upstreaming these changes. A quick search of lmkl.org doesn't show any hits for the switchto_... APIs. I'd love to hear otherwise or in more detail from someone at Google. It's frustrating to have to do archaeology just to guess what the state of the art is. Isn't sharing your findings part of "organizing the world's information"?
- noir_lord 9y ago"organizing the world's information" (when it's to our competitive advantage). It's the bit on the end that sounds a lot less noble.
- appleflaxen 9y agowow; that's a good example of why GLP v3 has value to end users of free software: the GPL2 allows them not to share improvements. The GPL3 requires the source code to be available, if those machines are used to serve results to users.
- snvzz 9y agoWouldn't that be the Affero license?
- gue5t 9y ago+1 on single-copy frequently being faster than zero-copy. See https://lwn.net/Articles/580194/ https://lwn.net/Articles/580194/ for a real-world example from the Linux kernel. On the topic at large, I think microkernel vs monolithic is not actually the important distinction in kernel design; robustness could improved vastly if the business logic of a kernel were implemented in a memory-safe language instead of C or C++. Register bashing and system setup won't ever be effectively captured by a typesystem (knowing what the semantics of hardware are is the hard problem, and GIGO applies to typesystems as much as anything), but most vulnerabilities are in code that doesn't directly interact with hardware (even if they're in a driver for some obscure hardware, it's generally the syscall-facing side that gets exploited). I'd like to see more OS development look at non-UNIX designs, rather than trying a million different ways to implementa UNIX-like interface.
- aidenn0 9y agoAlso, as a note, high-reliability microkernels disallow direct access to DMA registers (as, absent an I/O MMU, being able to write to a DMA register is the same as being able to write to any physical memory), and instead provide an API for programming them that can be verified on its own. This is often just dozens of lines of code, so can be as correct as the hardware. So the separation of register-bashing vs. the rest of the software already exists, but it solves the memory safety problem by just moving the unsafe code out of the kernel. I agree that memory-safe languages need to come into low-level systems programming, but garbage-collection is a non-starter for many many reasons, and the various academic languages (e.g. cyclone) have not made any inroads to industry that I'm aware of. Rust is very interesting to me in this field because the simple fact that it originated outside of academia may make it more palatable to many people; time will tell. [edit] I still think a microkernel is a good idea even with a memory-safe language just for defense in depth if nothing else (memory-safe runtimes tend to be complicated, and complicated code tends to have bugs).
- pjmlp 9y ago> I agree that memory-safe languages need to come into low-level systems programming, but garbage-collection is a non-starter for many many reasons, and the various academic languages (e.g. cyclone) have not made any inroads to industry that I'm aware of. Yet it was proven to work with: - Mesa/Cedar at Xerox PARC - Oberon, Oberon-2, Active Oberon at ETHZ - Modula-2+, Modula-3 at DEC/Olivetti - Sing# and System C# at MSR Apparently we can only get it properly done if a big company bullies the developers to adopt such an approach. Which is why I see as positive Apple, Google, Microsoft bullying devs to use mostly Swift, Java/Kotlin/Dart and .NET on their platforms, with C and C++'s role reduced to a few use cases. It really annoys me when I need to use the NDK on Google's case, but somehow it makes sense from security point of view.