Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Do I have enough information to do this problem and What exactly are the static and dynamic Chains? I am not a programmer and I am trying to get this right

Computer Science Oct 03, 2020

Do I have enough information to do this problem and What exactly are the static and dynamic Chains? I am not a programmer and I am trying to get this right.

Show the stack with all activation record instances, including static and dynamic chains, when executions reaches position 1 in the following skeletal program. Assume Bigsub is at level 1.

procedure Bigsub is
procedure A
procedure B is
begin -- of B
... <-- 1
end; -- of B
procedure C is
begin - of C
...
B;
...
end; -- of C
begin - of A
...
C;
...
end; -- of A
begin -- of Bigsum
...
A;
...
End; -- of Bigsum

Expert Solution

 

1. Static chain is a chain of static links that connects its activation record instance (ARI)to all of its static ancestors ARIs. Static chains connect the set of stack frames in each dynamic environment as a tree.

2. Dynamic chains is the collection of dynamic links in the stack at a given time.

In Procedure Bigsub, the dynamic chains just link each frame together in stack order.
The first frame on the stack (the top) points to the second frame, which points to
the third frame and so forth. Here is the call sequence produced by the above code:

BIGSUB -> A -> C -> B

This is just the stack, bottom to top (assume the stack grows "up").

B
C
A
BIGSUB

The dynamic chain is just the opposite:

B -> C -> A -> BIGSUB
(Think of the dynamic chain as encoding the "was called by" relation.)

To find static chains, go through the call chain and then, for each
frame, determine its static ancestors by inspecting the code (declaration nesting).

B -> A -> BIGSUB
C -> A -> BIGSUB
A -> BIGSUB

These links are all threaded together in the runtime stack. (Think of the static
chain as encoding the "child of" relation.) This can get a bit more confusing when
we have recursive activations on the stack. Then we need to distinguish each
activation but that's not the case in this example.

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment