Run-Time Environments Storage Organization
Every target program has its own logical address, and an executable program runs in it. The logical address space has the location for each program value. The target machine, compiler, and operating system share this logical address space. The operating system maps the logical addresses into physical addresses, which are usually spread throughout memory.
Subdivision of Run-Time Memory
The run-time storage comes into blocks. This block has the smallest unit of addressable memory known as a byte.
Code: Astatistically determined area to hold the executable target code by the compiler.
Static: The compiler-generated data, the global constant may be determined at compile time stored in another statistically determined area static.
Stack: A dynamic area to store activation records. The size of a stack can change according to the executable program.
Heap: Another dynamically allocated data object at run-time to store C functions malloc and free.
The statistically dynamic area stack and the heap is used to utilize maximum space at a time.
Static vs. Dynamic Storage Allocation
The prime issue in run-time storage is the layout and allocation of data to memory locations. This can be risky because the same name in a program can refer to multiple locations at run time. The static is used for compile-time, and the dynamic is used for run-time storage.
If the compiler makes a decision by looking only at the text of the program, not what the program does as execution time, then storage-allocation is static.
If the decision is made at the time while the program is running is dynamic storage allocation.
The compiler used the given two technique for dynamic storage allocation:
- Stack storage: The procedure’s local name is allocated on the stack.
- Heap storage: The procedure’s callee is allocated in a heap.