Run-time Storage Organization

The run-time environment is the structure of the target computers registers and memory that serves to manage memory and maintain information needed to guide a programs execution process.

Types of Runtime Environments –

  1. Fully Static :
    Fully static runtime environment may be useful for the languages in which pointers or dynamic allocation is not possible in addition to no support for recursive function calls.



    • Every procedure will have only one activation record which is allocated before execution.
    • Variables are accessed directly via fixed address.
    • Little bookkeeping overhead; i.e., at most return address may have to be stored in activation record.
    • The calling sequence involves the calculation of each argument address and storing into its appropriate parameter location and saving the return address and then a jump is made.

  2. Stack Based :
    In this, activation records are allocated (push of the activation record) whenever a function call is made. The necessary memory is taken from the stack portion of the program. When program execution return from the function the memory used by the activation record is deallocated (pop of the activation record). Thus, the stack grows and shrinks with the chain of function calls.


  3. Fully Dynamic :
    Functional language such as Lisp, ML, etc. use this style of call stack management. Silently, here activation record is deallocated only when all references to them have disappeared, and this requires the activation records to dynamically freed at arbitrary times during execution. Memory manager (garbage collector) is needed.

    The data structure that handles such management is heap an this is also called as Heap Management.

Activation Record
Information needed by a single execution of a procedure is managed using a contiguous block of storage called “activation record”.

An activation record is allocated when a procedure is entered and it is deallocated when that procedure is exited. It contain temporary data, local data, machine status, optional access link, optional control link, actual parameters and returned values.

  • Program Counter (PC) whose value is the address of the next instruction to be executed.
  • Stack Pointer (SP) – whose value is the top of the (top of the stack, ToS).
  • Frame pointer (FP) – which points to the current activation.

Note:
Activation records are allocated from one of static area (like Fortran 77), stack area (like C or Pascal) and heap area (like lisp).

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

2


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.