Memory allocation questions
For the following questions, submit your answers electronically to
Moodle in a single file. Use appropriate software for writing
technical text: don't just use a text file. Reasonable options that
come to mind are LaTeX (submit a PDF), Microsoft Word, or
OpenOffice.org Writer. (I'm partial to the third one, but use whatever
you think is best.) Perhaps there are other good alternatives you know
of.
- Languages that employ the reference model of
variables tend to use automatic garbage collection (Python, Scheme,
objects in Java, etc.), whereas languages that employ the value model
of variables tend not to use garbage collection (C, C++, Pascal,
etc.). Why does garbage collection make more sense for a reference
model language than for a value model language? Think about the
capabilities that C provides, and explain the implications of adding
garbage collection.
- Place yourself in the the role of being in charge of
language changes for the next version of Python or Java. You get to
decide what goes in and what doesn't. (The "owner" of Python, Guido
van Rossum, refers to himself as the Benevolent Dictator for Life.) On
the language mailing list, someone proposes adding a "free" command,
like the one that C has. Use of this command would be completely
optional, but a programmer could use it to save the garbage collector
the work of finding these pieces of garbage in order to improve
performance. Take a stand on whether or not this is a helpful idea,
and explain why. Be specific in how it would affect garbage collection
algorithms.