Slashdot Mirror


Linus vs Mach (and OSX) Microkernel

moon_unit_one writes "Linus Torvalds apparently doesn't think much of the Mach mirokernel and says so in his new autobiography called Just for Fun: The Story of an Accidental Revolutionary. See what he says in this ZDNet UK article." The age old mach debate resurrected once again. Anyone have the old Minix logs with Linus? Thats a fun one too.

24 of 394 comments (clear)

  1. Re:Mach is known as a bad microkernel implementati by bhurt · · Score: 5

    The fundamental problem is hardware. Task switchs, under *any* OS, take a long time.

    At the time of the Tannenbaum/Torvalds debate, the primary CPU in use was still the 386- which took 300 to 500 clock cycles to task switch. No, that's not a typo- three to five *hundred*.

    The situation has imporved enormously- Pentium class CPUs only take ~50 clock cycles to task switch. Of course, this is disregarding any TLB misses which are incurred.

    The task switch overhead is what caused NT to move the graphics calls into kernel space in 4.0 (causing a large improvement in performance and a huge decrease in reliability). The hardware costs of task switching is what kills "true" microkernel OSs on performance. And don't bother to whine about "poor processor design"- people (including me) want an OS that runs well on the hardware they have.

    The best operating systems are the "mutts"- not true microkernels nor true monolithic kernels. Which is how linux evolved- kernel modules for many if not most things, virtual file systems, etc.

  2. Re:Envy? by sjames · · Score: 5

    Evidence to the contrary need not be presented. At least, not until someone comes up with a reason for microkernels being bad/wrong/sucky.

    Good point! The biggest problem for microkernels is that they have to switch contexts far more frequently than a monokernel (in general).

    For a simple example, a user app making a single system call. In a monokernel, The call is made. The process transitions from the user to the kernel ring (ring 3 to ring 0 for x86). The kernel copys any data and parameters (other than what would fit into registers) from userspace, handles the call, possably copies results back to userspace, and transitions back to ring3 (returns).

    In a microkernel, the app makes a call, switch to ring 0, copy data, change contexts, copy data to daemon, transition to ring3 in server daemon's context, server daemon handles call, transitions to ring 0, data copied to kernelspace, change contexts back to user process, copy results into user space, transition back to ring3 (return).

    Those extra transitions and context switches have a definite cost. A CPU designed with that in mind can help (a lot!), but on current hardware, it can be a nightmare. That's why a monokernel tends to perform better in practice.

    Kernel modules in Linux are nothing like microkernel. They are just bits of a monokernel that are dynamically linked at runtime. In order to be a microkernel, each module would be a process and would reside in some ring other than 0 (possably 3, but not necessarily). In order to fully realise the microkernel module, users would be able to do the equivilant of insmod and get a private interface. Other users might or might not choose to access that module, and might insmod a different version with the same interface. This would not present a security problem.

    There may well be places where the overhead is a worthwhile trade off for the features (clustered systems might be a good example). Cray takes an approach like that (not exactly that, just like that) in mkUnicos for the T3E (possably others, but I've not used those).

    Some microkernels do a better job at efficiency than Mach (L3 for example). At some point, the hardware might actually get fast enough that the trade-off is nearly always worth while. Even then, monokernels will still have a place for situations where every cycle counts I don't anticipate those situations ever going away.

  3. here we go again... by peterjm · · Score: 4

    I remember, back when I was a kid, walking through the video store and looking at the covers of all the cool movies I wanted to watch.
    There was one in particular that stands out.
    It was called "The Exterminator". The cover had this arnold schwarzeneger looking guy in fatigues with this huge flame thrower, trying to blow torch the camera taking his picture.
    I used to look at that picture and think, "damn, that guy must be trying to start a flame war."

    I get the same feeling when taco posts stories like this.

  4. Re:MacOS/X is from BSD4.4, not Mach by binarybits · · Score: 3

    Darwin is Apple's buzzwordy name for the core of their OS. It didn't exist until Apple bought out Next and opened up their code. So Darwin is an Apple-created Unix-flavored OS that lies beneath the pretty GUI in OS X. Darwin was *not* developed by CMU or anyone else. It was written by Next developers using BSD as a starting point, but wasn't called Darwin until Apple bought the company and opened the source in ~99.

    Darwin is as much a BSD as any of the other flavors. It's built atop Mach because that's how Next did it, and they continued in that tradition. Mach is a microkernel, atop which rests a layer that implements a BSD interface.

    I'm pretty sure BSD *does* run on PPC hardware. NetBSD certainly does, and I think FreeBSD does as well. And there's certainly no reason that Apple couldn't have ported one of the to PPC hardware if they'd wanted to. The reason they didn't is that they were starting with Next technologies, so they used the Next kernel.

  5. Re:severe lack of information by binarybits · · Score: 5

    I'm pretty sure what he's saying is that classic apps don't have memory protection from one another, which is true but irrelevant-- the way classic Mac apps are written, most of them would break if you tried to protect them from one another-- they're used to stomping on each others' memory at will.

    The solution Apple hit upon was the next best thing-- put them in their own memory space all together, but protect them from other non-classic apps. There really isn't much you can do about this. OS X *is* a real Unix and is therefore (modulo kernel bugs and bad drivers) crash-proof. The classic environment crashes a fair amount, but with a little refinement it's not likely to be any worse than OS 9.

    Linus is either ignorant about the way Mac apps work or unrealistic about Apple's ability to dictate to its developers. Apple has an enourmous installed base of applications designed for OS 9, and if they were to throw those out, there would be essentially no software for the new OS. If, on the other hand, they had tried to design an OS that would support classic apps natively, they likely would have had to sacrifice system stability and performance to do it. Not only that, but if classic apps are supported natively, there's no incentive for developers to carbonize their apps, and therefore it's unlikely that the new API's will be widely used. This would greatly cripple Apple's ability to move the platform forward in the future.

    This plan is a sensible middle path. It allows a migration path to fully buzzword compliant Carbon and Coacoa apps in the future. With any luck, all the important apps will have carbon versions by this time next year, and by the time OS XI (or whatever) ships, they can disable classic by default and run only native apps.

    Look how long it's taken Microsoft to wean the Win 9x line of 16-bit apps-- they *still* have some hooks down to the lower levels of the OS 6 years after Win95 debuted. This is undoubtedly one of the causes of the OS's crappy stability and sluggish performance. Had they adopted a "virtual box" approach as Apple has, they'd probably have a much better OS today.

  6. How humble by WaterMix · · Score: 3
    [Linus'] new autobiography called Just for Fun: The Story of an Accidental Revolutionary [emphasis mine]
    Gee; I'm glad to see that Linus hasn't let his fame go to is head. I hope he just accidentallty hit the 'R' key in front of that last word.

    I don't mean to diminish what Linus has done, but RMS has done a boatload more for the "revolution" than Linus did.

    --
    Wade in the water, children.

    1. Re:How humble by kreyg · · Score: 3

      I don't mean to diminish what Linus has done, but RMS has done a boatload more for the "revolution" than Linus did.

      ????? There can only be one revolutionary? When did this turn into The Highlander?

      --
      sig fault
  7. Bah by mindstrm · · Score: 3

    Just like every other argument of this nature.

    Risc -vs -Cisc
    Microkernel -vs- Monolithic kernel...

    There's a theoretical side, and a 'reality' side.

    Is RISC cooler? Yes. Does that mean a chip is better because it's risc? No.

    Are there pros and cons between microkernels and monolithic kernels? Certainly, of course there are. Does that mean that linux is better than OSX simply because one is monolithic? No.

  8. severe lack of information by jilles · · Score: 5

    What are we supposed to think of this article? It lacks detail. In fact the only argument it puts forward are some vague remarks of linus (probably taken out of context) way back in 1997. Apparently there's an issue with lack of memory protection? I can't believe that would be true, I certainly haven't read anything about it in the reviews of mac os X (and they weren't that positive alltogether). This is typical for zdnet, inflamatory title, some vague bits and pieces. No facts, no details, and yet it makes it onto slashdot. I'd love to see how mac os x performs, I'm interested in benchmarks, comparisons, design issues. None of that can be found in this article.

    --

    Jilles
  9. Re:o no, not again!! by Flower · · Score: 5

    To be blunt, they all suck. Just look here.

    --
    I don't want knowledge. I want certainty. - Law, David Bowie
  10. Armchair critic? by TheInternet · · Score: 5

    Thanks for explaining why the system requirements for Mac OSX are so ludicrous.

    Mac OS X's requirements are "so ludicrous" because it has to run two OSs at once: Mac OS X itself and Mac OS 9 via the "Classic" environment. If you're only running native apps (which the are relatively few at this second, but many are coming this summer), then you'll probably do just fine on 64MB of RAM. Last time I checked, this is pretty comparable to GNOME or KDE.

    - Scott


    --
    Scott Stevenson
    WildTofu

    --
    Scott Stevenson
    Tree House Ideas
  11. Re:Linus vs. Tanenbaum by bugg · · Score: 3
    Sorry, but Tanenbaum was right on the number with this one. Ask anyone who's managed an open source project, or is managing one now (such as myself) and they will tell you that it's not that easy. It's not that people can jump in and submit a patch, and fix it all. That's a load of crap; most of the work in any project will be done by a handful of people, and that's that.

    We can also tell by the number of bugs found in things developed with a development model like Linux that the "many eyes make all bugs shallow" philosophy is crap as well; most bugs aren't obvious programming errors, and if they are in your project, find new developers.

    --
    -bugg
  12. Re:Linus vs. Tanenbaum by rkent · · Score: 3

    What?! Presumably you're saying that Linux wouldn't even have existed if the GNU kernel had been finished in 1992. Okay, maybe, but I don't think the GNU kernel is even "ready" now! Or if so, quite recently... So, yeah, it seems as if there was only an 8 year window of opportunity where Linux could have come about :)

  13. Linus is no longer "just a hacker" by Infonaut · · Score: 4
    he's the representative in the mainstream public's eye of Open Source in general and Linux in particular.

    I think that's why the press has latched onto this story, and why some of us find it particularly interesting. We all know that hackers flame each other, that for any technology to really matter, it has to originate from passionate individuals.

    But the rest of the non-geek world doesn't know this, isn't familiar with hacker culture and how ideas are discussed. The business world operates differently, and in the business world, attacks like his attack on Mach are often interpreted as signs of fear or weakness.

    It may be even more puzzling to the general public because they've been lead to believe that the Open Source community has always been interested in allowing many different technologies to flourish in a relatively benign environment.

    I applaud Linus for the tremendous work he's done over the years in developing Linux and championing Open Source, but if you want to convince folks that Open Source is a kinder, gentler way to compute, saying Mach is crap might not be the best approach.

    --
    Read the EFF's Fair Use FAQ
  14. Hugely misleading by the+Man+in+Black · · Score: 5

    I read the article at El Reg before it popped up here. The way this story is being presented by ZDNet, the Register, AND Slashdot is terribly misleading. As near as I can tell, Linus has nothing bad to say about OS X in particular...just it's usage of the Mach microkernel which he (and lots of other kernel hackers) have dismissed as crap.

    Reading anything else to it just turns the whole thing into a "Ooooh...the Linux guy HATES OS X! He must be threatened by it!" media frenzy. That single out-of-context quote, combined with "Linux as insofar failed to bring UNIX to the desktop, which is what Apple believes OS X WILL do", makes it even worse.

    I say humbug.

  15. Mach is known as a bad microkernel implementation by Carnage4Life · · Score: 5

    The main reason that microkernels have not gained more acceptance in OS circles (although Windows NT is based on microkernel design) is that the most popular implementation of the concept (Mach) is also one of the most inefficient and badly designed.

    In Joseph Liedtke's 1995 paper, On Microkernel Construction he points out that the myth of Microkernels being more inefficient and thus slower than monolithic kernels is because most benchmarks were done against the Mach microkernel. He stated that the Mach performed poorly at both address switching and context switching and also failed to take processors into account and be optimized thusly. As a test, Liedtke wrote a Microkernel OS called L3 in which he showed that a call to getpid which took 800 cycles of kernel time on the Mach to be performed took 15 - 100 cycles on the L3.

    Also he also disproved the notion that using a microkernel leads to memory degradation due to a large number of cache misses a dissects a number of benchmarks from Chen and Bershad's paper The Impact of Operating System Structure on Memory System Performance.

    Read his paper if you get the chance, it's very enlightening.

    The ideas behind microkernel design are very sound and some of them have found their way into most mainstream OSes (Linux kernel modules can be seen as a take on the Microkernel architecture). Basically, having an OS where everything is hot swappable including memory management, process scheduling and device drivers is kind of cool. Also the fact that the usual OS level APIs can now be swapped out meaning you can have both POSIX layer and a Win32 layer on the same OS is rather nice.

  16. Can you imagine? by SpanishInquisition · · Score: 4

    Linus declares : "OS X kicks ass, Mach is a superior architecture, Linux has a lot of catch up to do, heck, why not switch right away, I find the dalmatian iMac particulary tempting since I started smoking crack"
    --

    --
    Je t'aime Stéphanie
  17. Linus Quotes from 1992 by small_dick · · Score: 3

    "...linux is monolithic, and I agree that microkernels are nicer..."

    "...From a theoretical (and aesthetical) standpoint linux looses..."

    Thank you.

    quotes

    --


    Treatment, not tyranny. End the drug war and free our American POWs.
    See my user info for links.
  18. How long until we run OSX apps on LinuxPPC? by tz · · Score: 3

    I give it about a year. 6 months if there are a few geeks on a mission.

    Basically it would take binfmt_macho to be written, maybe an extended hfs (if we don't have an osxvfsshim module). And the syscall translation shim.

    And how long until it goes the other way? Add elf support (plus elf shared libs) and the linux syscall shim to Darwin? Maybe the same time.

    At some point they will cross and then Darwin will be subjected to natural seleciton.

    I already can run the Gimp on OS X.

    It is a bit silly to have a modular kernel and then always have to include the same modules. Meanwhile monolithic linux has modules that install devices, filesystems, almost everything (Until I had some hiccups with late 2.3, my kernel had a ramdisk and cramfs, and loaded the rest, I really should revisit that).

    At some point, probably 2-3 years, Darwin and Linux will either merge or become so cross compatible that one might all but disappear.

  19. Re:Why not work for them? by Nohea · · Score: 3

    That's the funniest part of the article: Steve Jobs thinks Linus would be more interested in working on OSX vs working on Linux. The assumption is that he would be more interested in hurting Microsoft, rather than actually having full control in creating an OS that has merits in it's own right. I guess it was worth a try, but purely machiavellian.

    I understand companies like Apple, Sun, Oracle wanting to compete with microsoft, but i don't like it when CEOs just are slapping at each other and getting in pissing matches.

    Plus, can you imagine Linus working for Jobs?

  20. Re:Linus vs. Tanenbaum by AntiPasto · · Score: 3
    Hrmmm... my bets are on the christmas tree.

    ----

  21. This is no surprise by wazzzup · · Score: 4

    It's no secret that Linus doesn't like microkernel architectures. What is really going on here is the press trying to create some buzz, get some hits on their web sites and sell some books. Many sites headlines are saying that Torvalds said OS X is crap, not the Mach kernel which, of course, is false. Read the article.

    If you were Apple, the decision going micro or monolithic was a no-brainer in my opinion. Ignoring the Tevanian-Mach connections, going monolithic with OS X would be putting too many eggs in one basket given the shaky CPU ground they're standing on. Mach gives them more alot more flexibility to jump the Motorola ship if forced to.

  22. Linus vs. Tanenbaum by skilletlicker · · Score: 3
  23. Re:Envy? by Spy+Hunter · · Score: 5
    No, Linus is not jealous of OS X. He most likely doesn't care at all about its user-friendliness. What he doesn't like is the fact that it uses a Mach-based kernel, and he happens to hate Mach.

    Linus' comments in the article have to do ONLY with the Mach microkernel. The GUI is irrelevant to him. He didn't create Linux to be user-friendly, so he has no reason to envy OS X for being user-friendly.

    --
    main(c,r){for(r=32;r;) printf(++c>31?c=!r--,"\n":c<r?" ":~c&r?" `":" #");}