christophe barbe on Wed, 6 Nov 2002 20:51:28 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] BSD total free memory in C ?


On Wed, Nov 06, 2002 at 01:37:56PM -0500, Jeff Weisberg wrote:
> 
> | Note that your mail client (?) seems to be broken (at least from the
> | thread point of view).
> 
> /usr/bin/mail
> 
> [remainder of initial response deleted]
> 
> no further comment.
> corner me at a plug meeting and ask me about
> mail clients, brokenness, and such... 
> (or don't, I may get violent)
> 

Ok no further comment about your
perhaps-not-broken-but-lacking-some-basic-features.

> | About your proposed 'read a value from a config file' (which is already
> | implemented), what would be a good default value? Is it going to be the
> | same default value on all systems or do you need ... an algorithm to
> | determine this value?
> 
> I would avoid 'all available memory'. On a system with other things running,
> it will degenerate into 'thrash around paging in+out of swap space',
> and using all available memory will cause other programs to fail if they try
> to allocate any memory (depending on the OS and whether it will overcommit
> on vm allocations or not (NetBSD does not)).

My understanding is that you should never try from user space to
differentiate between real memory and swap memory. Even if you allocate
memory that seems available according to the real free memory, other
apps can be pushed to used swap because of you and also your real memory
can become swap memory. 
I don't say that swap memory is good (far from that) but that from the
user level you can't differentiate real and swap memory and then it is
logical to check the total free memory.
 
> I would just pick an arbitrary number[1], and expect that users will tune
> it if they see fit. I wouldn't expect any particular number to be better
> for more users than another.
> 
> an example, netscape arbitrarily defaults to using 2M for its memory cache.

Netscape and libgphoto2 are clearly very different. A data in memory is
rarely big for netscape when it is often big for libgphoto2. Also the
common usage of netscape is more revelant than the one of libgphoto2. I
mean most people browse the (same) web with netscape but with libgphoto2
some are (taking) dowmloading hi-res pictures and movies when others are 
downloading low-res pictures.

But I agree that the user-specified limit is not so bad. I just believe
that we can do better (and still have the possibility to define a fixed
limit).

Christophe

> 
> 	--jeff
> 
> 
> [1] 14.37M seems like a good arbitrary number...
> 
> _________________________________________________________________________
> Philadelphia Linux Users Group        --       http://www.phillylinux.org
> Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug

-- 
Christophe Barbé <christophe.barbe@ufies.org>
GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8  F67A 8F45 2F1E D72C B41E

L'experience, c'est une connerie par jour mais jamais la même.
_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug