Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Marlena Frank: CoWeb Assignment 3
Here is Marlena Frank's CA3. I restored it after someone had overwritten it; she did it on time. —Jeff Rick
History of Object-Oriented Programming
- Invented the notion that everything is an object.
- With Sketchpad, created in 1963, it was the first object-oriented drawing program.
- It used prototype-based inheritance.
- With prototype-based inheritance, you not only inherit methods & attributes, but also the values of these attributes.
- He was a PhD student at the University of Utah in 1966.
- Believed that objects were the future of CS.
- Saw the computer as a meta-medium to encompass all other forms of media.
- Created Flex.
- An Object Oriented personal computer before its time.
- Enabled by Moore’s Law.
- First idea to see a computer as a collection of “networked computers”.
- Idea to define complex behaviors simply, took inspiration from Biology in this.
- 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.
Link to this Page
- Marlena Frank last edited on 2 May 2006 at 2:41 pm by penguin.cc.gatech.edu