Mach Kernel vs. XNU

When I ran $ls on my root directory a file /mach_kernel was found. I'm assuming this is the OSX kernel. I always thought that OSX used the XNU hybrid kernel, so why is this file called "MACH"? I'm running Lion.


Solution 1:

Based on what the Wikipedia page on XNU says, XNU is based on Mach. Since OS X started using the Mach kernel and now uses a derivative of it, they probably just kept the kernel's file name the same so they didn't have to tweak firmware during upgrades or with new machine releases.

Solution 2:

The file is called /mach_kernel for historic reasons; XNU is, indeed a hybrid of Mach and a BSD layer (forget Wikipeida, there's http://www.amazon.com/Mac-OS-iOS-Internals-Apples/dp/1118057651 which seems more definitive).

In actuality, this kernel isn't the exact image which gets loaded - there is a pre linked kernel cache (with all the necessary kexts) in /System/Library/Caches/com.apple.kext.caches/Startup.