From owner-freebsd-questions@FreeBSD.ORG Wed Apr 25 18:48:32 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67101106566B for ; Wed, 25 Apr 2012 18:48:32 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by mx1.freebsd.org (Postfix) with ESMTP id 1FA578FC12 for ; Wed, 25 Apr 2012 18:48:32 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SN7GL-0003nC-7D for freebsd-questions@freebsd.org; Wed, 25 Apr 2012 20:48:25 +0200 Received: from np-19-75.prenet.pl ([np-19-75.prenet.pl]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Apr 2012 20:48:25 +0200 Received: from jb.1234abcd by np-19-75.prenet.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Apr 2012 20:48:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: jb Date: Wed, 25 Apr 2012 18:48:13 +0000 (UTC) Lines: 57 Message-ID: References: <2FCC4ECF-DAC2-4701-B392-B0415528A4C7@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 79.139.19.75 (Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20100101 Firefox/10.0.2) Subject: Re: FreeBSD vice OS X memory management X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2012 18:48:32 -0000 Chuck Swiger 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