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 –
- 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.
- 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.
- 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.
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
- Runtime Environments in Compiler Design
- Difference between Memory and Storage
- File Organization in DBMS | Set 1
- File Organization in DBMS | Set 3
- File Organization in DBMS | Set 2
- Computer Organization | Different Instruction Cycles
- Computer Organization | Micro-Operation
- Computer Organization | Booth's Algorithm
- Computer Organization | Amdahl's law and its proof
- Cache Memory in Computer Organization
- Purpose of an Interrupt in Computer Organization
- Computer Organization | RISC and CISC
- Last Minute Notes Computer Organization
- Computer Organization | Von Neumann architecture
- Computer Organization | Locality and Cache friendly code