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).
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Runtime Environments in Compiler Design
- Difference between Memory and Storage
- Storage Structure in Operating Systems
- Cache Memory in Computer Organization
- Computer Organization | Amdahl's law and its proof
- Computer Organization | Hardwired v/s Micro-programmed Control Unit
- File Organization in DBMS | Set 2
- File Organization in DBMS | Set 1
- File Organization in DBMS | Set 3
- Computer Organization | Micro-Operation
- Computer Organization | Different Instruction Cycles
- Computer Organization | Booth's Algorithm
- Computer Organization | Instruction Formats (Zero, One, Two and Three Address Instruction)
- Computer Organization | Problem Solving on Instruction Format
- Computer Organization | Von Neumann architecture
- Computer Organization | Locality and Cache friendly code
- Computer Organization | Performance of Computer
- Last Minute Notes Computer Organization
- Differences between Computer Architecture and Computer Organization
- Purpose of an Interrupt in Computer Organization
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.