View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Adam Fitzgerald

my email: gtg485v@mail.gatech.edu
CA 3

Garbage Collection (3 pts):
A-
The advantages to using a garbage collection system are that it decreases development time, the programmer no longer has to worry about explicitly freeing memory. Garbage collection in a virtual machine can prevent virtual machine crashes caused by programmers freeing memory incorrectly. It should also ensure that the program does not make a mess on the system on which it is run, ensuring it won't leak memory. The disadvantage of garbage collection is the increased overhead that can impact the performance of the program. Another disadvantage is the decreased control programmers have over the amount of time that their program spends garbage collecting and dealing with memory.
B-
Reference counting is a method of garbage collection that tracks the number of references to a particular object. When the object is created and a variable is assigned a reference to it, the reference count is set to 1. Any time another variable is assigned a reference to the object the reference count is incrmented. Whenever a variable that references the object is reassigned (to reference another object) or passes out of scope the reference count is decremented. Any object with a reference count of zero can be garbage collected.

C-
The mark and sweep algorithm is one of the most basic Tracing algorithms. The name refers to the two phases of the algorithm. In the mark phase the collector looks at all the references in the program that point into the heap (from the registers, static memory, and the stack) also known as root nodes. The collector follows these references and marks the object, then follows any references they contain. When it reaches the end (ie. no new references) any unmarked object can be garbage collected. The sweep phase is when the unmarked objects are freed, allowing the program to use the memory the object had occupied.

D-
The "stop and copy" algorithm was designed to combat the fragmentation of the heap during program execution. The disadvantage to this algorithm, however, is that there is significant overhead associated with copying every live object each time collection is done. The stop and copy method is improved upon with with the generational collection algorithm. The generational algorithm reduces the overhead associated with copying live objects by separating the heap into sub heaps, each associated with a "generation of objects." The idea is that many objects are short lived, and many are long lived, and copying overhead can be reduced if the longer-lived objects had to be copied less often. As an object survives collection iterations, it is moved into and older sub heap generation. The older the generation of each sub heap, the less it is garbage collected, and thus the objects within them do not have to be copied as often. The generational technique can also be applied to the mark and sweep algorithm, and will result in improved efficiency of that algorithm as well.


History of Object-Oriented Programming
Ivan Sutherland-
Contributed to object-oriented program with his revolutionary program Sketchpad. Sketchpad pioneered the use of objects and instances with its representation of geometric data. If you drew and object, you could then create instances of it on the canvas. Changes to the "master" object would then propogate to the instances. It was also the first program that had a completely graphical user interface.
Alan Kay-
Alan Kay saw objects as the future of computing. He envisioned a computer, powered by object oriented programs, that would be usable in the home by a person of nearly any age. His biologically influenced insights into the nature of what object oriented programming would be contributed greatly to its inception.








Using Squeak's Debugger

The debugger in squeak is pretty robust. While programming/testing squeak will eventuall (as soon as you program in a bug) throw an error window that looks something like this:

Uploaded Image: error-window.png

The title of the window should describe the actual error that was encountered. The list of calls is the stack trace, which is essential because it shows which calls lead up the the error-generating call. To open up the squeak debugger, click on debug, which will open up a window similar to this:

Uploaded Image: debugger-window.png

In this window you the stack trace is still presented, along with some additional information. When you select a call in the stack trace, the code for that method is displayed. If you make a change to the code in this window and save it, the changes take effect immediately (if you hit proceed, it will proceed from the earliest change that effects the program execution). Also displayed are two lists of variables. On the left are displayed the attributes of the class that the message is in. On the right are the temporary method variables. From both lists you can examine and explore the values - a method of debugging that I find extremely useful.




Links to this Page