FreeBSD vice OS X memory management

jb jb.1234abcd at gmail.com
Wed Apr 25 18:48:32 UTC 2012


Chuck Swiger <cswiger <at> mac.com> writes:

> 
> On Apr 25, 2012, at 5:31 AM, jb wrote:
> > does OS X kernel share any code with FreeBSD kernel's memory management
subsystem ?
> 
> The simple answer is no.  A more complex answer:
> 
> % grep -ri freebsd xnu-1699.24.23 | wc -l
>      520
> 
> % grep -ril freebsd xnu-1699.24.23 | sort | uniq
> 
> 
> 
> % grep -ril freebsd xnu-1699.24.23 | sort | uniq
> ~/Downloads
> xnu-1699.24.23/EXTERNAL_HEADERS/stdbool.h
> xnu-1699.24.23/bsd/bsm/audit.h
> ...

Right, MM subsys is not part of BSD import.
But XNU kernel is a combo of Mach and old BSD kernel parts.

There was some discussion here:
http://www.osnews.com/comments/25861
where two comments are of interest:

"I'm quite sure that the memory manager of OSX wasn't derived from BSD, but from
Mach. Actually, FreeBSD has adapted that memory manager, so it's rather the
other way around. But Apple might learn from the way FreeBSD does things. If it
is feasible, as the kernel is quite different."

"The related implementation in FreeBSD seems to have a similar problem:

NetBSD users have also reported that UVM’s im- provements have had a positive
effect on their applica- tions. This is most noticeable when physical memory
becomes scarce and the VM system must page out data to free up memory. Under BSD
VM this type of paging causes the system to become highly unresponsive, while
under UVM the system slows while paging but does not become unresponsive.
http://static.usenix.org/event/usenix99/full_papers/cranor/cranor.p...

Should be easy to fix: just start to page out some stuff in time before there is
no memory left."

When I browsed the USENIX paper (dated 1999) I understood that it is indeed
possible that FreeBSD may have imported some Mach's MM code in those early
BSD VM days.

And over time since then some ideas (if not exact code) may have migrated
between OS X and FreeBSD MM subsystems.

If so, the problems experienced may be similar or identical even today.

jb




More information about the freebsd-questions mailing list