From owner-freebsd-questions Fri Aug 4 03:55:08 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id DAA04942 for questions-outgoing; Fri, 4 Aug 1995 03:55:08 -0700 Received: from diamond.sierra.net (diamond.sierra.net [204.94.39.235]) by freefall.cdrom.com (8.6.11/8.6.6) with SMTP id DAA04936 for ; Fri, 4 Aug 1995 03:55:06 -0700 Received: from martis-d227.sierra.net (martis-d221.sierra.net) by diamond.sierra.net with SMTP id AA08146 (5.67b8/IDA-1.5 for ); Thu, 3 Aug 1995 11:55:43 -0700 Message-Id: <199508031855.AA08146@diamond.sierra.net> From: "Jim Howard" To: davidg@root.com, freebsd-questions@freefall.cdrom.com Date: Thu, 3 Aug 1995 10:59:12 -0800 Subject: Re: 2.0.5 Eager to go into swap Reply-To: jiho@sierra.net X-Confirm-Reading-To: jiho@sierra.net X-Pmrqc: 1 Priority: normal X-Mailer: Pegasus Mail/Windows (v1.22) Sender: questions-owner@FreeBSD.org Precedence: bulk > to do about it. Ironically, shared libraries are supposed to help this > situation, but in FreeBSD they are so un-optimally ordered that applications > wind up consuming as much memory as they would if built non-shared (static). > The solution to this problem is to order the routines so that commonly used > ones are all grouped together, and further group together related routines. > This is difficult for two reasons: first, we don't have the statistics to know > how to order the routines properly, and second, our library build procedure > really doesn't allow for this. > > -DG > Wait a minute, in FreeBSD shared libraries are MAPPED in by ld.so using the mmap() function, using copy-on-write with text (code) pages marked read-only. That means shared libraries are used in as page-efficient a manner as is humanly possible, with virtually no human intervention. Physical RAM pages (4 KB chunks) are occupied as they are accessed, on the fly.... or at least, that's how it's supposed to work. Since mmap() syncs properly with files on disk, I have no reason to doubt it on this point. The mmap() function is really quite marvelous; that and ffs are what have me hooked on FreeBSD versus Linux. So what's going on? I have 8 MB of RAM with a 16 MB swap partition, and my machine behaves the same as people describe with 32 MB! When running X, my machine behaves as if the FreeBSD virtual memory subsystem were using the amount of virtual memory given to processes, rather than the number of pages actually occupied, as the basis for deciding whether or not to use swap. Which is crazy, because the point of swapping is to free up occupied pages when none are unoccupied. Right? Am I missing something here? --Jim Howard