Re: Question about memory size and performance

Attila Szegedi <[email protected]> Tue, 11 Dec 2007 13:29:56 +0100
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
On 2007.12.11., at 12:45, Endre Stølsvik wrote:

> The communications between the kernel and the GC could be even  
> tighter:
>
> "Kernel: dude, I'm really in bad need of some memory now, could you
> please free some? You don't REALLY need those 1.5 gigabytes, do you?"

 From my long gone days of Windows programming, I remember Windows  
sent out a WM_COMPACTING message to all top-level windows (your non-UI  
processes could create an "invisible window" for purposes of getting  
such notifications) when it was low on virtual memory. I remember I  
even filed a RFE in Sun's bug database years ago telling them it might  
be a good idea to run a full GC when the JVM process receives  
WM_COMPACTING. Strangely enough, Sun's bug database no longer brings  
up anything when searching for WM_COMPACTING.

Anyway, I agree that having the OS notify the processes when it's low  
on memory is a good option to have, but I believe it should be sent  
out only when the system is approaching its virtual memory limit, not  
physical memory limit. It should be a last-ditch attempt to prevent  
running out of virtual memory.

> "Kernel: Okay, so Rome is burning, and I'll evict some of your stash  
> now
> - have any preferences, do you?"

I'm not sure whether that makes sense. Virtual memory managers  
typically use LRU strategies, maybe enhanced to also factor in the  
cost of writing out a dirty page (therefore being biased toward  
ditching clean pages from physical memory earlier). I'm not sure if  
application-specific intelligence could enhance things here.

> "Process: I'd like to really fatten up - but how much may I ask for  
> and
> still not go into The BadLands?" (aka Swap).

Hm... I'm not sure if kernel could give a reliable answer to this one,  
as it depends on what other processes on the box are also doing.  
Physical memory is also used by the OS for other purposes than keeping  
the processes' working sets (i.e. for filesystem caching), so this'd  
again be a hard thing to get right (that is, use it in a way that  
actually increases the overall performance of the system).

Attila.

--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com