Re: C is too old? opinions?




Logan Shaw wrote:
Phlip wrote:
goose wrote:

Now I'm really curious; how does the garbage collector run in
deterministic time? Is it possibly a case of running the gc after every X
operations knowing that no more than Y memory has to be released and that
doing that will require no more than Z time?

Making a garbage collector deterministic would defeat the point of a
garbage collector - trading programming time for run time.

If the programmer must specify "please collect this and this object, now,
before the next real-time strobe", they might as well use pointers and
'free()'...

I think what is meant is making the running time of the garbage collector
deterministic. If you could ensure that a garbage collection system
would increase the running time of any arbitrary section of code by no
more than a constant (and known) factor, then you retain the ability
to predict the running time of your code either through theory or through
testing. You could, for example, use every other clock cycle for
garbage collection (to make a gross oversimplification of what the
algorithm would really be like). It would be just like running on a
processor at half the clock speed (or some other factor): it's slower,
but it's still capable of real-time guarantees.

- Logan

Assuming the alternate clock cycle (or a second CPU), the garbage
collector algorithm then would have to deal with pointers changing
while it is running. That makes the process more complex.

A deterministic garbage collector has to be very carefully written. I
haven't seen algorithms for this, but there are a lot of factors to
consider. I'd have to pull out some old text books to see what approach
would work, but merely allocating arbitrary CPU cycles is not going to
solve the problem of making a deterministic GC.

Ed

.



Relevant Pages

  • Re: C is too old? opinions?
    ... garbage collector - trading programming time for run time. ... to predict the running time of your code either through theory or through ... algorithm would really be like). ... A deterministic garbage collector has to be very carefully written. ...
    (comp.programming)
  • Re: Advanced data structures
    ... garbage collector the ... needlessly thrashes memory is not visible in the code you write. ... If we can count the allocation calls, we know how much the algorithm ...
    (comp.lang.c)
  • Re: Destroying an Object
    ... Does ruby's garbage collector really work, or it's as lame as .NET ... The newest .NET GC uses an algorithm ... Ruby's GC is much less buggy ...
    (comp.lang.ruby)