- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Static Allocation?
It is the simplest allocation scheme in which allocation of data objects is done at compile time because the size of every data item can be determined by the compiler. The main function of static allocation is to bind data items to a particular memory location. The static memory allocation procedure consists of determining the size of the instruction and data space.
Recursive Subprogram and Arrays of adjustable length are not permitted in a language. In static allocation, the compiler can decide the amount of storage needed by each data object. Thus, it becomes easy for a compiler to find the address of these data in the activation record. FORTRAN uses this kind of storage allocation strategy.
The binding of the name with the amount of storage allocated does not change at runtime. Therefore, the name of this allocation is static allocation. In static allocation, the compiler can decide the amount of storage needed by each data object. Therefore, it becomes easy for a compiler to find the address of these data in the activation record.
At compile time compiler can fill the addresses at which the target code can find the data it operates on.
Implementation of the call statement
The codes needed to implement static allocation are as follows −
MOV #here +20, callee.static_area /*It saves return address*/
GOTO callee.code_area /*It transfers control to the target code for the called procedure */
callee.static_area− An address of the activation record.
callee.code_area− An address of the first instruction for called procedure.
#here +20− Literal return address which is the address of the instruction following GOTO.
Implementation of return statement
A return from procedure callee is implemented by −
GOTO * callee.static_area
This transfers control to the address saved at the beginning of the activation record.
Implementation of action statement
The instruction ACTION is used to implement an action statement.
Implementation of halt statement
The statement HALT is the final instruction that returns control to the operating system.
- It is easy to implement.
- It allows type checking during compilation.
- It eliminates the feasibility of running out of memory.
- It is incompatible with recursive subprograms.
- It is not possible to use variables whose size has to be determined at run time.
- The static allocation can be done if the size of the data object is known as compile time.
- The data structure cannot be created dynamically, in the sense that, the static allocation cannot manage the allocation of memory at runtime.
- Related Articles
- What is a static channel allocation in computer networks?
- Static Channel Allocation in computer network
- What do you mean by static memory allocation in C programming?
- What is Stack Allocation?
- What is Heap Allocation?
- What is Capital Allocation Line?
- What is Dynamic Memory Allocation in C?
- What is channel allocation in computer network?
- What is Stack Allocation of Procedure Calls?
- What is Implementation of Simple Stack Allocation Scheme
- What is a Dynamic channel allocation in computer networks?
- What is techniques of storage allocation in compiler design?
- What is Static Prediction?
- What is static electricity?
- What is Static Type Checking?