MkLinux: Apple-Funded Port of Linux to the Power Mac / Mach Microkernel
mklinux.org
mklinux.org
Edit: [1] I think the hardware was this: https://en.wikipedia.org/wiki/Power_Macintosh_7600
Anyway, the great thing about hosting on Classic Mac OS is that there was nothing to exploit. With no remote admin capabilities beyond some Appletalk-related stuff, even if someone did find a way to compromise your system, the only thing they could really do was freeze it. I threw a Mac OS 7.5-ish (obviously I am forgetting numebrs) Mac up on the Defcon LAN and put the IP on the whiteboard for targets, and not a damn thing happened. Not even a hang...
I left the company to come back a couple months later as a consultant. Just about every sysadmin had one on their desks by then.
Regular Linux distributions would have to rewrite the kernel, hope it's accepted upstream, fork or patch-and-pray.
I'm sure certain concepts were borrowed from Mach and implemented in Linux and the other way around.
https://en.wikipedia.org/wiki/Mach_(kernel)#Mach_concepts
> And if it adds so much value,
It isn't that simple. There are tradeoffs made with every kernel design decision.
People often tend to stick with what they know.
In the late 80s, the Open Software Foundation (OSF) was founded as a consortium of seven major tech companies spearheaded by DEC to standardize Unix in response to AT&T and Sun's adoption of SVR4. They adopted Mach as part of this and ended up extending it to add locksets, semaphores and resource ledgers. MkLinux was then a joint effort in 1996 by Apple and the OSF to both have Linux on the PPC and exploit Mach features in the single-server emulation.
As such, the history is convoluted. It's not that Mach is so great, but rather that circumstances made it creep in various places.
I went to Sun and learned how a kernel could work and could perform and the allure of Mach, for me, started to wane. Reading the mach code made it worse, especially compared to the Sun code.
All these years later, I remain underwhelmed. Linux has a nicer VM system, performs better, and is more readable. Not Sun level readable by any stretch, but better than my memory of mach (which, to be fair, is in the distant past).
If someone can point to actual real world data that shows Mach to be better performing on the same hardware I'd be interested in seeing that, I tend to think that's not possible.
If you want to see what a real microkernel done right looks like, go look at QNX before they added the POSIX conformance. You have 4-5 people logged into an 80286 doing work. Very, very light weight and well done. They were the only guys that understood what the "micro" in microkernel meant. I remember Dan Hildebrandt telling me that the microkernel easily fit in a 4K instruction cache (it pretty much had to, it didn't do much so you needed some space for whatever it was dispatching).
Solaris source is the state-of-the-art. If there's a "beautiful" kernel, Solaris is definitely the one. QNX also is one very well made kernel(its like a OS created by a zen master).
It's a pity that sun took so long to open the source of Solaris, or else i could be typing this from a solaris kernel, instead of Linux.
But even in 2005, when they decided to open the source, it was already too late, because Linux was already a big hit by that time.
But, to use Illumos as a first machine, can be really painful, exactly because of the lack of adoption, and the lack of drivers and software as a consequence... that's the reason of my comment about the time to open the code.. and Oracle closing it up again, didnt help it either.
I would definetly consider Ilummos as a server node.. but for a personal machine.. it can get painful really easy, if you use for development like i do.
I have no idea what the "mach" at the heart of OS X is, but I'm sure it is not the Mach as described in the literature (anymore).
Animats and I both thing QNX was the best microkernel of the period, used successfully from embedded to [briefly] desktop prototypes. Managed to get microkernel advantages while being fast and deterministic. People working on new one's should take lessons from them. INTEGRITY RTOS's have some nice design choices, too, like making apps donate their own resources to kernel functions they call and using only predictable instructions in critical paths.
Mach is crap compared to the competition. Despite all the attempts to make it not so.
http://genode-labs.com/publications/nizza-2005.pdf
Case study for a secure, IPsec VPN with Nizza below:
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=B12...
Applied to secure filesystems
https://www.usenix.org/legacy/event/atc11/tech/slides/weinho...
You can do a lot with that model whether you use a recent L4 kernel or some other microkernel. If you're into that stuff, I'd say check out the GenodeOS project at genode.org. Unlike most, their OS is using as many robust components from academia as possible while attempting to integrate them into something usable. They have a microkernel, a resource architecture, Nitpicker GUI, and so on. It needs help wherever people can get it.
https://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/Ma...
We tend to keep the TCB small as less code = less bugs. We simplify it because simpler code = easier verification. Usually... More important is you know what states or execution effects each component can have in a way that can be abstracted into analyzing those above it. So, the thing can be 4Kloc or 100Kloc, but it should be easily analyzed and composed modules.
One problem I noticed, though, is that systems without needed functionality get continuous, ad-hoc versions of that functionality from their developers. C and UNIX were perfect examples with all kinds of extensions there was a mess trying to cover stuff that came by default in prior languages and platforms. So, there was less safety & consistency anyway despite underlying tool being primitive.
This led me to shift from "simple & tiny as possible" to the simplest version of tools that make it as easy as possible to do right. Bernstein et al's Ethos & NaCl projects are perfect examples where internally they're a bit complex but interface is simple to use & securely. Just got to find the right balance.
A lot of good wisdom on such things is from Karger et al in the link below on high assurance virtualization. See "layered design" especially for verbal and visual explanation:
So, there were lots of interesting papers and work on it. Anyone could've gotten sucked in. After a while, though, it became clear that Mach was a bad track with research shifting to L4 and commercial microkernels (esp RTOS, sep kernels). Torch passed to groups like Dresden and NICTA.
Relevant to your QNX claims:
https://news.ycombinator.com/item?id=10483544
https://web.archive.org/web/20011106140711/http://www.qnx.co...
For example, Apple no longer relies on the Mach port mechanism for IPC, instead mostly relying on their own, better XPC, which forms the foundation for libdispatch (aka Grand Central) and OS X's sandboxing.
Of course, XNU is also a monolithic kernel, not a microkernel.
Transitioning to a different kernel would probably be a costly mostly-zero-velocity project for Apple, especially now that they are no longer in the server OS space. A different kernel might require replacing IOKit, unless one could write a compatibility layer for it.
When Apple bought NeXT, Tevanian became CTO as part of the reverse management takeover. The Mach version underlying Openstep was updated for OS X, but kept around since Tevanian was very much a Mach booster.
NeXTStep was based on a Mach+BSD kernel, which at the time would've been an obvious thing to do if your goal was to create a modernized Unix system with all the latest cutting-edge (in the mid-80s!) technologies available.
That kernel lives on in OS X and its descendants. It was always built as a monolithic kernel, AFAIK. It just differed from a traditional BSD kernel in that the lowest layers (VM, process, thread, and scheduler stuff) were replaced by the Mach microkernel. I believe that this kind of monolithic Mach+BSD arrangement was a pretty common thing to do when developing a Mach-based Unix implementation.
From the outside it's almost indistinguishable from a BSD kernel. So why not just use an ordinary BSD kernel? Because it future-proofs the design. It gives you an easy path to gradually moving kernel-space services out of the core kernel and into separate address spaces, as microkernel technology improves and it becomes practical to do so. Of course, that never really happened, but it was a very logical choice at the time.
There were other benefits to Mach- you also got multithreading (this was a big deal, mid-80s remember), as well as Mach IPC. Mach IPC has its pros and cons, but just being able to have user and kernel services communicate via arbitrarily defined protocols rather than having to constantly add new system calls is very convenient.
That's pretty much it. This system has been around for > 30 years now, and even though it never turned into a true microkernel system, there probably was never much of a reason to de-Machify it either. It would be a ton of work and you wouldn't gain anything. It's not that Mach is so awesome (although it has some niceties), it's more that there's a lot of momentum there, and you wouldn't really gain anything by rewriting all that code.
As for why Linux distributions don't use it, the same reasons apply. It'd be too much work for relatively little benefit. It made sense to base your cutting edge kernel on Mach in 1985, not so much 30 years later. It doesn't make sense for OS X to stop using it for the reasons given above, but it also doesn't make much sense for anyone who isn't already using it to base new stuff on top of it today.
This was all pre Cathedral and Bazaar (1997) so Linux wasn't really on the radar at most companies.
I'm surprised to see this got updates all the way up to 2009!
EDIT: I'm thinking back... I was pretty young at the time 14-15 yo. And just learning to program, and what I really loved about BeOS was how easy the API was to learn. I had been learning C/C++ in MachTen and never could wrap my head around making Machintosh GUI applications. But sitting down with the Online documentation in BeOS, it was VERY easy to make a program with 3D graphics and a native GUI. Later on, QNX gained a lot of popularity I think for the same reasons (fantastic documentation and API). I had worked on a project under Solaris which relied on POSIX.4 extensions (yikes) before moving it to QNX.