Why Mach instead of all BSD

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why Mach instead of all BSD

JesseVoss
HI,

I've heard a lot of complaints that Apple uses the microkernal Mach 3.0. I found these accusations to be false. I went to the website OS X internals (Click Here)and it gave a great break down about what is under the hood in mach OS X. According all the complaints I've heard about OS X Mach sucks at what it is supposed to do--Memory management. So It makes me wonder why apple doesn't just use FreeBSD for that portion. Any smart people know anything? Why use Mach at all? Does Mach have something to do with the ability to run on PPC and x86?


Please help.

I did not find the right solution from the internet.

References:
https://arstechnica.com/civis/viewtopic.php?f=19&t=246132
Online Video Service
 
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Why Mach instead of all BSD

laffer1
Administrator
Apple's kernel is called XNU.  It does contain some Mach 2.5/Mach 3 code including the IPC features. Apple doesn't use a pure mach kernel.  Some parts are from BSDs.  In other cases, they have replaced it with something newer like the IOKit / driver model which is written in C++.  

The actual problem with Mach kernels historically was the performance impact.  In the old days, estimates on 486 systems were around 10% if I recall correctly.  However, modern systems are very fast to a point that the overhead is low.  System calls are slower (slightly) due to the message passing overhead. Newer microkernels also solved many of these issues in various ways.  Consider the L4 kernel.  

Apple has several advantages by using Mach IPC. For instance, look at how launchd works.  They have great abstraction and the ability to run processes as other users with the kernel validating access.  

FreeBSD also runs on PPC and x86 so portability isn't necessarily a factor. It is easier to port a mach kernel in theory because components are isolated.  The advantage of a micro kernel is that individual features or functions are isolated from each other.  If the sound process crashes, it can be restarted.  If it's a blob of code inside the kernel, it will likely just cause a kernel panic and reboot the box.

You also forgot about ARM.  iOS runs the same basic kernel for iPhones and iPads.