Re: [Gc] A student assignment based on bdwgc

Bruce Hoult <[email protected]> Thu, 19 Mar 2015 15:52:37 +1300
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <CAMU+Ekyi6+UCrBagE=Ux37ed_YfzKK56LuW5pYq1p=7CwtkEaw@mail.gmail.com>
I think it's an excellent idea to introduce students to C programming using
a garbage collector. Many professional programmers don't seem to realize
that GC is not a convenience reserved to programmers using Java or Python.
Using C with GC is much more pleasant (and safe!) than using C with
malloc/free.

I don't think it's realistic to have CS101 students modify bdwgc. Graduate
students or advanced undergrads maybe, but it would be an extraordinary
first year student who could be successful.

However simply reading some of the code may be instructive. Bdwgc is a
software library that has existed in some form for nearly THIRTY years!
See:

Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative
Environment", Software Practice & Experience, September 1988, pp. 807-820.

http://www.hboehm.info/spe_gc_paper/preprint.pdf

Boehm, Hans-J., Alan J. Demers, and James E. Donahue, ‘‘A Programmer’s
Introduction to Russell’’, Technical Report 85-16, Computer Science, Rice
University, 1985

http://www.math.bas.bg/bantchev/place/russell/russell-intro.pdf

Most of the description in the first paper still applies. There are some
changes, for example the block header information has since been taken out
of the blocks, and fewer distinct object sizes are supported (object
requests are rounded up to the next larger size). However the basic
principles still apply.

Over the last 25 or so years bdwgc has been ported to a vast number of
different operating systems. It may be instructive for students to see how
differences between the different machines have been coped with in real
production code (largely by macros and conditional compilation).


I don't think there is much of a wish list for bdwgc. The gc code itelf
been pretty well optimised and debugged over the last 25 years.

There is room for additional facilities for debugging. For example dumping
various descriptions of the heap, or explaining why a particular object
can't be collected. That kind of thing. That might be within reach of a
good student.

One thing I'd personally like is to see it usable on smaller machines. In a
previous life I used it on mobile phones with as little as 400 KB of RAM,
and the fact that it had (from memory) about 150 KB of statically allocated
global arrays was pretty annoying. I got that down to I think about 15 KB,
but unfortunately I wasn't allowed to distribute that code, and don't have
access to it any more anyway.

I'd love to be able to use GC in programming microcontrollers such as the
Arduino. Unfortunately, you'll never fit bdwgc into something with 2 KB of
RAM. But creating a new GC suitable for such uses might be a good project.
Some of the ideas in the "Chicken" Scheme compiler might be useful.


On Wed, Mar 18, 2015 at 1:02 PM, Henryk Michalewski <
[email protected]> wrote:

> I am running a CS 101 class at the CS department of the University of
> Warsaw. This class is focused on the C language. I like the idea of
> making a student software project based on bdwgc  and contemplated
> options such as
>  - implementation of alternative gc algorithm
>  - some optimizations/improvements in the current code
>  - building an additional tool conceptually related to bdwgc
> The final project should not exceed 2000-3000 lines.
>
> Maybe this is a stupid idea in the sense that in your view this is a
> too tough assignment - please feel free to inform me about it.
> Otherwise, I would be glad to hear some specific recommendations from
> the authors!
>
> Yours, Henryk Michalewski
>
> --
> http://www.mimuw.edu.pl/~henrykm
> _______________________________________________
> bdwgc mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/bdwgc
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>

_______________________________________________
bdwgc mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/bdwgc