Slashdot Mirror


OS X Kernel Overview

Don Negro writes: "Found this on Apple's Developer site. A solid overview of the OS X kernel - what bits are Mach, what bits are BSD - and a good level a detail. This is the first installment. As they say in the introduction 'Only you can prevent kernel panics.'"

28 comments

  1. Damn... by TheQuantumShift · · Score: 1

    I wasn't any of the mentioned in the "who should read this book" section... guess I'll have to wait till some educated /. reader para phrases it...

    --

    Shift happens. Fire it up.
  2. Re:No kidding by TheQuantumShift · · Score: 3, Funny

    And if M$ ever put one of these out, It'd be called "Move Along, Nothing to see here..." or "All you ever wanted to know about world domination, but were afraid to ask"...

    --

    Shift happens. Fire it up.
  3. Re:No kidding by rebug · · Score: 2

    "Keep Out" is the kind of message that makes people feel nifty about not keeping out.

    --

    there's more than one way to do me.
  4. I was going to read it... by Sentry21 · · Score: 3, Interesting

    I opened the link and read through the introductions, with the intent of reading. I'm a middling-to-pathetic C/C++ programmer, and I figured it might be interesting to join into the kernelnewbies project - then this came out.

    Now, I'm scared. Honestly, after reading through that introduction, I'm scared to touch kernel code. Hell, I'm scared to look at it.

    I think Apple did a great job with this document. They don't want anyone writing code unless they know EXACTLY what they're doing (the code, they say, has to be well nigh perfect), so they put in as much intimidation as they can manage without being overly conspicuous.

    The newbies will be scared, the people with no confidence (like myself; I don't remember ever compiling warningless code on the first go; if I'm writing something complex, I'll miss a }, if I'm writing Hello World I'll forget to #include) will be scared. The only people who will even think about trying their hand at kernel programming are Gods and fools.

    Good job Apple, you really know how to screw with heads. ;>

    --Dan

    1. Re:I was going to read it... by Arandir · · Score: 4, Insightful

      Now, I'm scared. Honestly, after reading through that introduction, I'm scared to touch kernel code. Hell, I'm scared to look at it.

      That's kernel code for you :-)

      You can be the best programmer in the world, know assembly/C/C++ inside and out, and all that jazz, but when you hit kernel code it's like a different reality.

      --
      A Government Is a Body of People, Usually Notably Ungoverned
    2. Re:I was going to read it... by pthisis · · Score: 3, Insightful

      From Alan Cox, in the kerneltrap interview running on the front page of slashdot right now:

      Ignore everyone who tells you kernel hacking is hard, special or different. It's a large program, and bug fixing or driver tweaking can be a best starting point. It is however not magic, nor written in a secret language that only deep initiates with beards can read.

      Play with it, try things, break it horribly and enjoy yourself. I started on the networking code because it didn't work very well. Everything I knew about TCP/IP I had downloaded the same day I started hacking the net code. My first attempts were not pretty but it was *fun*.


      Sumner

      --
      rage, rage against the dying of the light
    3. Re:I was going to read it... by Arandir · · Score: 2

      My point was not so much that kernel code is different from systems or application code, but that the *domain* is so different.

      An analogy can be made with the English language. You may be the most fluent English speaker ever, written dissertations on Shakespeare, Jonson and Chaucer, but the first time you read an insurance policy you say to yourself "that sure looks like English, but damn it, it just won't parse!"

      --
      A Government Is a Body of People, Usually Notably Ungoverned
    4. Re:I was going to read it... by pthisis · · Score: 2

      Sure. But that goes both ways. _If_ you know asm and C well, going from kernel code to GUI code has a lot of pitfalls (as does the opposite). Or going to numerical recipe code, or whatever.

      But fundamentally, code is code and rather than be intimidated you should start reading and playing with it. Even if you never become a hardcore kernel hacker, it's another world that's definitely worth jumping into and not nearly as scary as you think.

      Alan's Gearheads Only articles in Linux Magazine are a great way to start out.

      (FWIW, I posted mainly as a gedanken piece and not because I think you're way off base; sometimes you see a quote that just seems applicable to another conversation...)

      Sumner

      --
      rage, rage against the dying of the light
    5. Re:I was going to read it... by jaseman21 · · Score: 1

      Messing with OS X kernel code, eh? Ladies and Gentlemen, the iHack has landed.

  5. My favorite quote... by jarodss · · Score: 2, Insightful

    "Kernel programming is by and large a black art that should be avoided if at all possible."
    Heh, I like that, so true.

    It's something to hang beside my copy of the 2.4.15 kernel source code, I had to print it, my boss had a good laugh at it when I showed him, we have a few guys in house who are on the cutting edge of everything they can be and were running 2.4.15, about half lost their work because they were on the bleeding edge.

    1. Re:My favorite quote... by Anonymous Coward · · Score: 0

      There's a difference between "You're Linus and you still make mistakes" and "You're a Mac developer and you barely know the difference between kernel and user-space code because it's an entirely new concept."

      The point (I think) is to say ask developers to double-think if they really need kernel code to do what they want (something Linus often tells people too).

  6. Keep Out by Anonymous Coward · · Score: 0

    What assholes. Nice "keep out" message.

    For all Linux's faults, at least they don't have the annoyance problems of the Darwin/BSD set.

    1. Re:Keep Out by Anonymous Coward · · Score: 0

      Oh, and before anyone explains that kernel programming can lead to fucked systems, duh. So can anything that can be buffer overflowed or leak memory or run bad code. The kernel is one system among systems. At least a race condition just may make the system hang.

      How does one learn without making mistakes? Just don't make mistakes on things that can hurt others.

    2. Re:Keep Out by Anonymous Coward · · Score: 0

      please shut your fucking mouth. please shut it and keep it shut. you are stupid and you shouldn't be allowed to talk. please stop doing so. fuck you.

  7. Heh...times are a'changing by Linux+Freak · · Score: 2

    I particularly liked this quote:

    ``Kernel code must be by and large perfect. A bug in the kernel could cause random crashes, data corruption, or even render the operating system inoperable. It is even possible for certain errant operations to cause permanent and irreparable damage to hardware, for example, by disabling the cooling fan and running the CPU full tilt.''

    Back in the days of the TRS-80, those of us comfortable with playing around with BASIC, Tiny Pascal, and Z80 assembly used to try to comfort friends who were just learning to program and were a little more than scared at breaking the computer with, ``Don't worry, you can make whatever mistakes you want; it's not like anything you do is going to break the hardware''. :-)

  8. Re:No kidding by Lars+T. · · Score: 2
    From the Linux source:
    This is the Kernel source code. If you are an inexperienced hobby coder, please feel right at home and change anything you like.
    Well, I sure hope I'm wrong.
    --

    Lars T.

    To the guy who modded me down from perfect to terrible Karma - Apple haters still suck

  9. Sheesh... by CottonEyedJoe · · Score: 2, Insightful

    From the posts here, you'd think the title of the article was "Look at the silly Keep Out page".
    Cmon guys its just a disclaimer. Given the potential audience, its not a bad disclaimer either. Traditional mac "classic" developers are used to doing anything they want with system extensions. If you've used MacOS9 and below, youre aware that there are a plethora of extensions out there that can cause all sorts of headaches...not all are freeware hobbiest projects.

    More than anything else, I see that page as a warning to those used to using extensions to trample all over Apple's system code and cause major stability issues in the process in MacOS (not OSX).

  10. PDF version by gorillasoft · · Score: 2, Informative

    The pdf version is much easier to read through than the site.

  11. Learning the basics of kernels by PoiBoy · · Score: 1
    I've been using Linux and Solaris more or less exclusively for the past three years or so, but I've never payed much attention to the internals of the kernel.

    If someone has just relatively basic programming knowledge of C/C++, what's a good way to start learning about kernels?

    I've got an old 486 not doing anything, and I was thinking about how I could start from absolute scratch and try and build a trivially simple kernel (and shell to communicate with it). Where should I start?

    --
    Sig (appended to the end of comments you post, 120 chars)
  12. So far so weak by selectspec · · Score: 2

    The disclaimer is out of sync with the substance of the documentation. I found the overview to be nothing more than a entry-level introduction, lacking in many critical details that would prove relevant to somebody actually writing the code. However, to be fair, I've rairly come across a decent kernel developer text, especially where BSD is concerned. The code seems to be the only documentation when it comes to kernel development.

    --

    Someone you trust is one of us.

  13. Bibliography? by alacqua · · Score: 1
    "For more information on basic operating systems programming, you should consider the texts mentioned in the bibliography at the end of this book."

    There are a few references to this bibliography, but I was unable to find it. I assume that this book is a work in progress and that part hasn't been posted yet. I didn't miss anything, did I? I would be interested in what books they recommend (actually, I would be interested in slashdot readers' recommendations, too).

    --

    Move on. There's nothing to see here.
  14. Wake me when it's done by brucehoult · · Score: 2

    Well there's almost no meat in that book yet :-(

    It would also be nice if the author and/or editor would learn the difference between "difference" and "dereference" which is wrong thoughout...

  15. Re:No kidding by Anonymous Coward · · Score: 0

    Inexperienced hobby coders such as yourself are more than welcome to change any bit of the Linux kernel they see fit. That's why Linus lets you download it and play with it!

    Of course, if you diff your tree and send a patch, its highly unlikely that Linus (or Marcelo) will accept it.

  16. Be patient by ZigMonty · · Score: 2
    Here's a quote from the ADC (Apple Developer Connection) newsletter:

    This first installment of Apple's new "Kernel Programming" book delivers high-level information about the Mac OS X core operating-system architecture, as well as background for system programmers and developers of device drivers, file systems, and network extensions.

    In short, this is only the first chapter of the book. I like that they're releasing it piecemeal, it's better than waiting for the whole thing to be written. So far they've done the "Is this for you?" bit and have just completed the overview. Apple is pretty good at writing documentation to describe how something works (within reason) rather than just it's API. IMHO, this will probably be a good doc to read when it's finished, even if you prefer a different kernel.

  17. Re:No kidding by Lars+T. · · Score: 2
    Bwahahahaha! You're so l33t.

    So if I, the "inexperienced hobby coder", change kernel code, fuck up, damage my machine, Linus will pay the bill? Or will he just say "Why the hell did you do this?"

    Slashdot: News for l33t Linutix haxors.

    --

    Lars T.

    To the guy who modded me down from perfect to terrible Karma - Apple haters still suck

  18. Messed up kernal by obi-1-kenobi · · Score: 0

    I have done some tinkerin with my macintosh, lets just say I'm not very good with code. Blasted spelling. Well i have had to re-install macosx 4 times... That is a new record for me seeing as i did it in one week... My advice is if your computer works for you and you like it don't tinker with the kernal.

    --
    "You win again Gravity!" -Futurama (Zapp)
  19. wow by jaseman21 · · Score: 1

    Holy crap. Is this supposed to be Apple's way of keeping down rookie programmers? Could Apple be brainwashing young programmers to join their cause???