First time here? Checkout the FAQ!
+1 vote
Consider the following two statements:
 S1: Activation records can have permanent lifetime in case of static allocation.
S2: Activation records can have nested lifetime in case of stack allocation.
Which of the option is correct regarding S1 and S2 respectively
(A) True. True
(B) True. False
(C) False. True
 (D) False. False
asked in Compiler Design by Veteran (37.5k points)  
retagged by | 166 views
option c ?
Its A.

4 Answers

+2 votes

Activation records have Permanent Lifetime in case of Static Allocation, 
bcoz in case of Static Allocation, Activation records r fixed in static memory area so why it supports function calling but not recursion
Nested Lifetime in case of Stack Allocation
bcoz in case of Stack Allocation, Activation record are pushed into stack area during function call or recursion nd popped out on function return. so why these r nt permanent
Hence ans is A

answered by Veteran (10.9k points)  
But why is it permanent ? It will also get destroyed after main is finished ? I just have doubt with the word "PERMANENT" ?
Permanent is used in the sense that a variable is bound to a fixed location in static allocation.

Yes ultimately everything gets destroyed after program termination!! :p
^ u r correct
+1 vote

Activation records have Permanent Lifetime in case of Static Allocation, Nested Lifetime in case of Stack Allocation and Arbitrary Lifetime in case of Heap Allocation.

So, option A.

answered by Boss (8.2k points)  
How is it permanent in static, won't it be destroyed after main returns or finishes ?
Provide explaination if possible ?
+1 vote

Activation Record has 3 kind of allocation

1)Static allocation

2)Stack Allocation

3) Heap Allocation

Static Allocation means it is in a fixed location of memory. Doesnot change when program executes.No change required at runtime.

Stack Allocation means it works like LIFO. So, requires recursive function calls


answered by Veteran (58.5k points)  
0 votes
b)Stack/Heap allocation is used in dynamic storage allocation , also recursion is supported here which means there will each activation record for each procedure call i.e. nested ARs so as each procedure completes its work its AR  gets deleted.

Moreover there is dynamic chain which provides stack nature of Activation Record

a) Activation Records are created at compile time and in static allocation method and are removed when programme is over(or after running garbage collector) So we can say that ARs have permanent lifetime.

here permanent means during all course of programme running.
answered by Junior (803 points)  

Top Users Sep 2017
  1. Habibkhan

    7142 Points

  2. Warrior

    2640 Points

  3. Arjun

    2480 Points

  4. rishu_darkshadow

    2466 Points

  5. A_i_$_h

    2214 Points

  6. nikunj

    1980 Points

  7. manu00x

    1846 Points

  8. makhdoom ghaya

    1770 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points

26,133 questions
33,705 answers
31,105 users