Garbage collection for system programming

"Simon" <sheath1@gmail.com>
28 Feb 2005 01:00:55 -0500

          From comp.compilers

Related articles
Garbage collection for system programming sheath1@gmail.com (Simon) (2005-02-28)
Re: Garbage collection for system programming torbenm@app-4.diku.dk (2005-02-28)
Re: Garbage collection for system programming Martin.Ward@durham.ac.uk (Martin Ward) (2005-02-28)
Re: Garbage collection for system programming richard.xian@gmail.com (Richard Xian) (2005-03-01)
Re: Garbage collection for system programming nmm1@cus.cam.ac.uk (2005-03-01)
Re: Garbage collection for system programming sheath1@gmail.com (Simon) (2005-03-01)
Re: Garbage collection for system programming torbenm@app-4.diku.dk (2005-03-04)
[2 later articles]
| List of all articles for this month |

From: "Simon" <sheath1@gmail.com>
Newsgroups: comp.compilers
Date: 28 Feb 2005 01:00:55 -0500
Organization: http://groups.google.com
Keywords: GC, question
Posted-Date: 28 Feb 2005 01:00:55 EST

Greetings! I've been thinking about and writing computer languages
for a little while now (nothing beyond the toy level so far, but...),
and am curious about systems-level programming languages like C,
Modula-2, and so on. However, I haven't really done any large
low-level projects with these languages, so my experience is a bit
limited.


Anyway, what I was wondering is this: How feasable is it to use a
garbage-collected language for low-level tasks like writing operating
systems, device drivers, memory allocation systems, and basically
anything else you would HAVE to write in C instead of, say, Objective
Caml. I know it can be done; Oberon has a GC'd kernel, I've heard
that an old Scheme called T had it's garbage collecter implemented IN
Scheme, I've heard about an OS written in Modula-3, and so on.


However, all the non-conservative garbage collectors I've seen need
some metadata attached to each record, class, array, or whatever, and
most generally have some order in the layout and alignment of structs
as well. So basically, my question is this: How does having that
additional metadata sitting around your heap make it harder to write
low-level programs where every byte counts? Does one often have to
work around it using C or assembly, or is it generally not much of an
issue? Could you write a low-level systems language with garbage
collection, without everyone having to sabotage some way around it?


Thanks,
Simon
[I wouldn't worry about every byte counting so much as realtime issues
in device drivers and the like. I've done plenty of system programming
like DNS servers in perl, but never anything where there were time
contraints.


There's an old joke about a tennis playing robot programmed in Lisp
that has an unfortunate habit of GC-ing after the backswing. You can
certainly make rules about time critical code not calling routines
that might provoke GC but that recreates the programming problems that
GC is there to solve. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.