What features does Darwin have that other Unixes don't, or vice versa?

OS X is the only remaining operating system based on the Mach microkernel which is also still commercially relevant. There are a few ongoing research projects and obsolescent OSes that no doubt are still being used in production settings on old machines, but nothing you can go out and buy on a new machine today.

OS X has the usual assortment of kernel feature incompatibilities that any *ix has. The biggest one I most recently had to work around is a lack of System V message queues. (msgget(2) and friends.) We had to replace our message queue code — which was written for a "real" System V variant and later ported to Linux — with TCP/IP to get our software to run on OS X. For our application, the differences between these two IPC methods mattered at the time we made the choice to go with message queues, but due to later architectural changes, it ended up not being a big deal to switch to TCP/IP.


When it comes right down to it, isn't Darwin just a thin BSD layer on top of Mach 2.0?

I used to use NeXTStep, I don't know how much current MacOSX departs from NeXTStep, but...

Mach 2.0 offered a different set of abstractions at the kernel level:

  1. A "task": that's an address space + a set of "ports", possibly with a thread running in it.
  2. Threads. This was the schedulable unit of execution. A task (address space) could have more than 1 running in it. I believe that Mach-O files (Mach's executable file format) could specify more than one thread at process run time: no main() function that started more Cthreads, the OS would start one.
  3. Ports. These aren't like TCP or UDP ports. They were typed, ordered streams of messages. Rather RPC-like. You made up a protocol spec file, then ran that through a compiler to get server and client side stubs, marshalling and unmarshalling routines, etc.
  4. User level memory pagers. You could set up a task+thread to handle paging of other tasks' address spaces.

The original CMU Mach folks used these abstractions to emulate BSD Unix processes, MS-DOS processes, and in a fabulous fit of freakiness, VMS tasks. Each VMS task took 2 Mach tasks, plus many threads. Somebody used to sell a Mac OS (pre-OSX) emulator for NeXTStep that used the user-space-pagers to good effect.

The old CMU Mach publications page: http://www.cs.cmu.edu/afs/cs/project/mach/public/www/doc/documents_top.html

The VMS-on-Mach paper: http://www.sture.ch/vms/Usenix_VMS-on-Mach.pdf


This isn't quite an answer but, DTrace is an awesome system debugging tool that exists for Solaris, Darwin/OS X, and *BSD, but not Linux.

Tags:

Darwin

Osx