Memory - Management - Exercises and Solution
Memory - Management - Exercises and Solution
Management
Exercises
Presented by Group 7
Group Members
2
Exercise No (1)
3
1.Consider the following block structure
(a)Draw the activation record stack region that occurs between the static and dynamic chain pointers when
the following sequence of calls,P1,P2,P3,P4,P2 has been made.
P1,P2,P3,P4,P2
4
Display for calling sequence
(b)Draw a diagram showing the display and
the stack by using calling sequence in no(a).
1 2 3 1 2 3
1 2 3 1 2 3
5
Exercise No ( 2 )
6
(2) Consider the following program fragment:
8
(c) Draw CRT and hidden stack when execution reaches the B(). CRT with hidden stack
9
Exercise No ( 3 )
10
A, B, C, D, E, B
11
Display for Calling Sequence A,B,C,D,E,B
(b) Draw a diagram showing the display and
the stack by using calling sequence in no (a).
12
(c) Draw CRT without hidden stack after the calling sequence in no (a).
13
(c) Draw CRT without hidden stack after the calling sequence in no (a).
14
(d) Draw CRT with hidden stack after the calling sequence in no (a).
15
(d) Draw CRT with hidden stack after the calling sequence in no (a).
16
Exercise No ( 4 )
17
Association List
(4) Consider the following program
fragment written in a pseudo-language
program a() {
x: integer; y: integer; x = 1; y = 3;
procedure b() { y: integer; x = 2;
d(); }
procedure c() { x: integer; b(); }
procedure d() { x: integer; z:
integer; x = 4; z = 6; }
c();
}
18
(b)Draw CRT without hidden stack when execution reaches the d().
19
(c) Draw CRT with hidden stack when execution reaches the d().
20
Thank You for Your Attention !