[Haskell-cafe] An interesting paper on VM-friendly GC
Andrew Coppin
andrewcoppin at btinternet.com
Sat Oct 16 05:35:54 EDT 2010
On 15/10/2010 11:50 PM, Gregory Crosswhite wrote:
> On 10/15/2010 03:15 PM, Andrew Coppin wrote:
>> On the other hand, their implementation uses a modified Linux kernel,
>> and no sane person is going to recompile their OS kernel with a
>> custom patch just to run Haskell applications, so we can't do quite
>> as well as they did. But still, and interesting read...
>>
> Ah, but you are missing an important fact about the article: it is
> not about improving garbage collection for Haskell, it is about
> improving collection for *Java*, which a language in heavy use on
> servers. If this performance gain really is such a big win, then I
> bet that it would highly motivate people to make this extension as
> part of the standard Linux kernel, at which point we could use it in
> the Haskell garbage collector.
Mmm, that's interesting. The paper talks about "Jikes", but I have no
idea what that is. So it's a Java implementation then?
Also, it's news to me that Java finds heavy use anywhere yet. (Then
again, if they run Java server-side, how would you tell?)
It seems to me that most operating systems are designed with the
assumption that all the code being executed will be C or C++ with manual
memory management. Ergo, however much memory the process has requested,
it actually *needs* all of it. With GC, this assumption is violated. If
you ask the GC nicely, it may well be able to release some memory back
to you. It's just that the OS isn't designed to do this, so the GC has
no idea whether it's starving the system of memory, or whether there's
plenty spare.
I know the GC engine in the GHC RTS just *never* releases memory back to
the OS. (I imagine that's a common choice.) It means that if the amount
of truly live data fluctuates up and down, you don't spend forever
allocating and freeing memory from the OS. I think we could probably do
better here. (There's an [ancient] feature request ticket for it
somewhere on the Traq...) At a minimum, I'm not even sure how much
notice the current GC takes of memory page boundaries and cache effects...
GC languages are not exactly rare, so maybe we'll see some OSes start
adding new system calls to allow the OS to ask the application whether
there's any memory it can cheaply hand back. We'll see...
More information about the Haskell-Cafe
mailing list