Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Group: Cheesy Mice
CoWeb Assignment #3
Garbage Collection (3 points)
- Advantages of Garbage Collection
- Ease a programmerís burden because they donít need to keep track of memory leaks.
- Increase security and safety to keep hackers from attempting to obtain valuable data from memory leaks.
- Disadvantages of Garbage Collection
- You lose performance because the program will run slower so that this background maintenance can be completed.
- Lack of control because the programmer has no control over what is removed and what isnít.
- Reference Counting
- The program keeps track of all of the references to an object, and whenever this reaches 0 it is removed.
- Suppose the following was a listing in memory with the numbers corresponding to the number of references that block of memory had.
- After a few passes the references may drop out or remain the same.
- This process requires a number of complete passes through memory which takes time.
- Every store to memory requires incrementing and decrementing.
- This slows down the program and leaves this method the most inefficient of all garbage collections.
- Mark and Sweep
- Used with Tracing Collectors.
- Traces from a root object to everything.
- Marks whatís accessible in the object header
- Sweeps away anything else
- Suppose that the following is a chunk of memory. The Xís represent memory that is accessible, and the Oís represent memory that is not.
- So instead of having incrementing/decrementing to deal with, there is a simple true or false value. Then the inaccessible memory is cleaned out.
- Problems with Garbage Collecting
- A lot of times even though memory is freed up, it is so fragmented that it cannot be reused for new objects. Therefore memory fragmentation is a major problem.
- One method for addressing this problem is Stop and Copy which requires double the amount of memory. But after sweeping through the memory, the memory with accessible data can be copied to the other half Ė but placed in such a way as to compact space. Maintaining references is the key to a successful compacting strategy.
- Another problem with Garbage Collection is speed. The mark and sweep method requires a number of passes over the entire memory usage in order to mark and the clean out unused memory. Generational Scavenging is a method to decrease the number of passes that need to be made. There are different categories for different parts of memory. The youngest generation is checked the most often. If a young generation data persists for a certain amount of time, it is then promoted to an old generation Ė which is not checked as often. This decreases the amount of entire memory mark and sweeps that are necessary and speeds up the garbage collection process dramatically.
History of Object-Oriented Programming (1 Point)
Ivan Sutherland wrote a revolutionary computer program called Sketchpad in 1963 in the course of his PhD thesis. It helped change the way people interact with computers. Sketchpad is considered to be the ancestor of modern computer-aided drafting (CAD) programs as well as a major breakthrough in the development of computer graphics in general. Ivan Sutherland demonstrated with it that computer graphics could be utilized for both artistic and technical purposes in addition to showing a novel method of human-computer interaction.
Alan Kay is one of the founders of the idea of object-oriented programming, along with some colleagues at PARC and predecessors at the Norwegian Computing Centre. He is the conceiver of the Dynabook concept which defined the basics of the laptop computer and the tablet computer and he is also considered by some as the architect of the modern windowing graphical user interface (GUI).
CoWeb Assignment 1 #2
Links to this Page