[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jul 11 00:05:41 2001 
Subject:Re: Incremental garbage collection 
From:jeffb 
Volume-ID:1010711.01 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen,

In message <P05100e01b744f4bbfc1f@[192.168.1.14]>, Stephen Leach
<steve@watchfield.com> writes
>Continuing the comments on garbage collection made by Aaron Sloman ...
>
[Much fascinating information on garbage collection skipped]

>An alternative to incremental garbage collection is speculative garbage
>collection.  If I ever get the time I will add it to Poplog.  The basic
>idea is to perform a stop-and-copy that can be abandoned instantly - as
>soon as a signal arrives.  [I've never seen this in the literature, I
>came up with the idea a couple of years ago, but I rather doubt it is
>original to me; it is too obvious.]
>
>Is it possible to perform a speculative stop-and-copy (Cheney) garbage
>collection?  Because the copy phase destructively updates the current
>heap (from-space) it is a little puzzle to work out how it should be
>done.
>
>Here's a simple method: take a fresh copy of the relevant part of the
>heap - it is easy to see that this can be done speculatively.  Now
>perform a speculative Cheney-style copy collection into to-space.  If
>you've done all that without an interrupt, switch the from and to
>spaces.  Note that the speculative copy-collection must adjust for the
>offset between the original heap (from-space) and its speculative
>clone (cloned-space).
>

I've always wondered how difficult it would be to speculatively collect
garbage from one end of the heap by collating non-garbage at the other.
This would work best in an event-driven environment. The heap would be
in a constant state of having non-garbage being migrated to one end or
the other. Possibly this is a task that the Operating System's Idle
process could be modified to perform.

>Of course, this argument does not require a copy of the entire heap;
>the relevant part of the heap is the unlocked part.  This is typically
>only a few MW of store.  [If you are interested in having a go, here are
>a some helpful hints.  It is easy to do better than the algorithm I've
>outlined above.  To avoid cloning the unlocked region of the heap you
>can use a hash-table to store the forwarding pointers. An alternative is
>to pad each heap object with a spare word.  This padding can be
>optional and dynamically eliminated when the heap grows "too big".  Being
>"too big" is a tuning parameter - bad news - but relatively simple to
>define in terms of available RAM.  Lastly, it is important to consider
>how to manage potentially uncontrolled destroy actions.]
>
>It is clear that speculative garbage collection would eliminate
>garbage collection "glitches" from a vast range of programs that interact
>with people.  While waiting for user-events, garbage collection would
>silently take place - might as well use the wait for something useful.
>The same would apply to servers, too.  Let's suppose you write a web
>server in Poplog (like my Palantir server) then when the server is waiting
>for some request to happen it can do a nice tidy-up.
>

Regards,
- -- 
Jeff Best (jeffb@jtbest.demon.co.uk)
ICQ# 66426833

-----BEGIN PGP SIGNATURE-----
Version: PGPsdk version 1.7.1

iQA/AwUBO0r8RfHj+enJbeYqEQL4iACgtOrTzroSbV5iwB9/blFKfKNivGcAoJon
kfD8rGyaQkuNF65LByBQM6dw
=lhZN
-----END PGP SIGNATURE-----