Skip site navigation (1)Skip section navigation (2)
Date:               Thu, 3 Aug 1995 10:59:12 -0800
From:      "Jim Howard" <jiho@sierra.net>
To:        davidg@root.com, freebsd-questions@freefall.cdrom.com
Subject:         Re: 2.0.5 Eager to go into swap 
Message-ID:  <199508031855.AA08146@diamond.sierra.net>

next in thread | raw e-mail | index | archive | help
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508031855.AA08146>