FreeBSD and MacOS

Q q_dolan at yahoo.com.au
Thu Jul 1 18:54:38 PDT 2004


On 02/07/2004, at 5:29 AM, Justin Walker wrote:
> On Jun 30, 2004, at 23:33, Q wrote:
>
>> Darwin still uses a Mach kernel design, although Apple has made some  
>> significant modifications to its implementation to reduce message  
>> passing overhead and latency etc, making it something of a hybrid and  
>> no longer a pure micro-kernel.
>
> To get pedantic, the Darwin kernel of Mac OS X is not a microkernel.   
> Although it used the code-base of Mach 3.0 as a starting point, it is  
> monolithic, as were the pre-3.0 versions of Mach.  In fact, I doubt at  
> this point that you could get any micro-kernel functionality to work  
> based on Darwin.

Correct, the Darwin kernel is not a micro-kernel (I never said it was),  
but it is not monolithic either, to be pedantic it is actually a  
"hybrid kernel" (1) or modified micro-kernel because it shares the  
message passing design of a micro-kernel, but includes otherwise  
"non-essential" components in kernel space.

(1)  
http://en.wikipedia.org/wiki/ 
Monolithic_kernel#Hybrid_kernels_.28modified_microkernels.29

>> As a result the Darwin Mach kernel is not the traditional Mach mix of  
>> userspace/kernelspace RPC connected components, instead the kernel is  
>> linked into a single address space, using kernel extensions (loadable  
>> modules) in a similar way FreeBSD does.  However these extensions are  
>> implemented using a highly object oriented API (IOKit) for  
>> interacting with the kernel, instead of the traditional struct  
>> passing procedural approach used in FreeBSD.
>
> The device driver model (IOKit) is C++, using the "embedded C++"  
> constraints to avoid a huge C++ runtime in the kernel.  Other  
> extensions (file system and network plugins), however, are not.

This is true, I should have been more specific, I was attempting to  
highlight the most obvious difference without going into too much  
detail.

>> The portions of the FreeBSD kernel that Apple have adopted can be  
>> found as part of the XNU project (the darwin kernel) from Apple's  
>> Opensource website
>> http://www.opensource.apple.com/darwinsource/
>> The CVS tags should still be intact on the files in question.
>>
>> While FreeBSD provides a sizable chunk of Darwin's BSDness, it still  
>> has a decent amount of legacy NeXT/BSD code in it as well.
>
> I'm not sure precisely what you mean here, but the Darwin kernel has  
> been completely rewritten since the days of NeXT.  There may be minor  
> bits of NeXT code left, but I don't think it's much.

Ok, let me rephrase, I'm referring specifically to BSD kernel code.  
While there is a sizable amount of "BSD" code taken primarily from  
FreeBSD in the darwin kernel, there is still a reasonable amount of  
original "BSD" code (4.3/4.4BSD) that has come indirectly into the code  
base (via NeXT, you can tell by the license body) and not directly from  
the FreeBSD source tree.  That's not to say there is much difference in  
a lot of cases, but any FreeBSD specific alterations will not be  
represented in these portions of the code. The UFS/FFS code is a prime  
example. A lot of the UFS/FFS code in both FreeBSD-5 and Darwin is  
quite different due to evolutionary changes in FreeBSD (eg. snapshots,  
UFS2, softupdates), but there are also some files that have been  
virtually unaltered from 4.4BSD and in these cases it wouldn't really  
matter where they came from.

The point I was making is that there is still a bit of a mixture of  
sources that make up the BSD'ness of Darwin, and as a result there are  
still some notable parts of FreeBSD missing.

>> Some of the things that have been adopted from FreeBSD/NetBSD in the  
>> Darwin kernel include:
>>
>> Crypto support
>> Filesystem support for CD9660, DEVFS, NFS, VFS, MEMDEV (Curiously  
>> this doesn't include UFS/FFS support)
>> IP & IPV6 TCP stack support including BPF & IPFW
>> Most of the BSD/Posix/SYSV system calls (sysctl, fork, exec, ktrace,  
>> mmap, etc) and corresponding MAN pages.
>
> Sounds like you've been doing some homework :-}

Yes, you might say that I have developed a rather healthy interest in  
the topic recently.

-- 
Seeya...Q

                -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                           _____  /  Quinton Dolan - q_dolan at yahoo.com.au
   __  __/  /   /   __/   /      /
      /    __  /   _/    /      /        Gold Coast, QLD, Australia
   __/  __/ __/ ____/   /   -  /            Ph: +61 419 729 806
                     _______  /
                             _\




More information about the freebsd-hackers mailing list