go to previous page   go to home page   go to next page

Answer:

Yes. Now each activation of Pyramid() will first activate Triangle() before it activates another Pyramid() .

The complete diagram (showing all activations) would be the same, but the order the circles are drawn would be different.


Single Chain of Activations

Pyramidal Call Chain

Let us continue to use the original definition and the original activation diagram. Play with the activation diagram again and pay attention to what circles are active and inactive.

Although the complete diagram shows several branches, there is never more than a single chain of activations. There is only one path from main to the current activation at the end of the chain. (The dotted circles are not active; their work is done.) Where there is a branch in the diagram, only one branch or the other is active at any point in time.

The activation chain is always linear: each node is linked to at most one predecessor and one successor. In the diagram the active circles have a solid color. The formerly active circles are dotted. The solid circles form a linear chain.

The activation chain behaves like the type of data structure called a stack. A stack is a linear arrangement of data that grows and shrinks. Growing and shrinking always occur at the end of the stack. The complete diagram (including active and inactive nodes) is a type of data structure called a tree. Stacks and trees are important topics in Computer Science covered in the course Data Structures.


QUESTION 8:

Say that your program is running and that there are several activations on the activation chain.

Which activation on the chain represents what the processor is currently working on?


go to previous page   go to home page   go to next page