Re: Microkernels are easier to build than Monolithic kernels
Posted: Tue Sep 06, 2022 3:09 pm
It seems I've been dreaming of the best of both worlds: restartable services and everything thoroughly tested. It's a dream. It might be achievable in a single-developer or small-team OS. I chose interactive Forth partly because it makes simple testing so easy, but the other day I caught myself not testing a definition because it wasn't easy to test interactively.
Mach has poor performance? That's interesting to me, because I've recently been comparing Mach, in the form of OS X 10.5, with Windows 10 & 11. Different generations, I know, and it's only a subjective comparison, but there's this one use case where old OS X was clearly faster than new Windows. It's Eagle Mode, a zoomable UI in which the file manager reads the contents of files to display them as you zoom in and out through the directory structure. If I'm not mistaken, it uses POSIX-ish open/close/read/write; I don't see any signs of mmap. It was easily usable as my normal file manager in OS X (and Linux and FreeBSD too), but in Win10 and Win11, it stutters so much as to be uncomfortable in Win11, barely usable in Win10. (Or perhaps: uncomfortable on exfat, barely usable on NTFS.) I think it's a known fact amongst Windows programmers that "sequential IO" (as they call it) is unoptimized, but Apple must have done something interesting to Mach to put it in the same league as Linux in this use case.
(I'm not praising Eagle Mode here, it should have been designed with more asynchronous internal interfaces. It's just interesting to see what it reveals.)
But speaking of 1st-generation microkernel Unixes, what about QNX? It was renowned for being quick (and very small). Perhaps they invented optimizations and didn't publish.
Smol correction: MINIX version 3 is not intended to be a teaching OS. It's aiming for full production quality with all services restartable. I last heard about it years ago when they'd recently had to accept that they needed the MMU, and seemed to have a lot of work to do to adapt. That may have been 8-10 years ago. It can't have been released since then or I'm sure we'd all know, so it doesn't seem to be progressing much faster than GNU Hurd.nexos wrote:The idea that microkernels are "slow" is based off of first-generation microkernels (MINIX and Mach mainly). MINIX is a teaching OS, not really production quality. Mach is a failure-by-design in a lot of ways. Don't get me wrong, Mach has clever ideas but is implemented very poorly. This was due to Mach's poor spatial locality and large, complicated IPC mechanism
Mach has poor performance? That's interesting to me, because I've recently been comparing Mach, in the form of OS X 10.5, with Windows 10 & 11. Different generations, I know, and it's only a subjective comparison, but there's this one use case where old OS X was clearly faster than new Windows. It's Eagle Mode, a zoomable UI in which the file manager reads the contents of files to display them as you zoom in and out through the directory structure. If I'm not mistaken, it uses POSIX-ish open/close/read/write; I don't see any signs of mmap. It was easily usable as my normal file manager in OS X (and Linux and FreeBSD too), but in Win10 and Win11, it stutters so much as to be uncomfortable in Win11, barely usable in Win10. (Or perhaps: uncomfortable on exfat, barely usable on NTFS.) I think it's a known fact amongst Windows programmers that "sequential IO" (as they call it) is unoptimized, but Apple must have done something interesting to Mach to put it in the same league as Linux in this use case.
(I'm not praising Eagle Mode here, it should have been designed with more asynchronous internal interfaces. It's just interesting to see what it reveals.)
This could be very nice, but the phrase "many optimizations" raises a warning flag in my mind. It suggests complex or counterintuitive code, perhaps with difficult debugging for OS developers.nexos wrote:Second-generation microkernels (L4) are much faster. E.g, a round trip syscall on Mach took 500 us, on L4, 16 us. I believe a Unix system based on L4's design principles could potentially take the OS world by storm. By implementing small, fast messaging using many optimizations, microkernels could get somewhat close to their monolithic counterparts.
But speaking of 1st-generation microkernel Unixes, what about QNX? It was renowned for being quick (and very small). Perhaps they invented optimizations and didn't publish.