Storage organization

STORAGE ORGANIZATION
During the execution of a program, the same name in the source can denote different data objects in the computer.The allocation and deallocation of data objects is managed by the run-time support package
Terminologies:
1. Name storage space: The mapping of a name to a storage space is Called environment
2. Storage space value: The current value of a storage space is called its state.The association of a name to a storage location is called a binding. Each execution of a procedure is called an activation. If it is a recursive procedure, then several of its activations may exist at the same time.
3. Life time: The time between the rst and last steps in a procedure. A recursive procedure needs not to call itself directly.
General run time storage layout:

Activation record:

Activation record: Data about an execution of a procedure.
Parameters: Formal parameters the declaration of parameters. Actual parameters the values of parameters for this activation.
Links: Access (or static) link:a pointer to places of non-local data, Control (or dynamic) link a pointer to the activation record of the caller.
Static storage allocation:
There are two different approaches for run time storage allocation
1. Static allocation.
2. Dynamic allocation.
Static allocation:
1. Uses no stack and heap.
2. A.R. in static data area, one per procedure.
3. Names bounds to locations at compiler time.
4. Every time a procedure is called, its names refer to the same pre-assigned location.
Disadvantages:
1. No recursion.
2. Waste lots of space when inactive.
3. No dynamic allocation.
Advantages:
1. No stack manipulation or indirect access to names, i.e., faster in ac-cessing variables.
2. Values are retained from one procedure call to the next.
For example: static variables in C.
Static storage allocation:
On procedure calls:
The calling procedure:
1. First evaluate arguments.
2. Copies arguments into parameter space in the A.R. of called procedure.
Convention: call that which is passed to a procedure arguments from the calling side, and parameters from the called side. May save some registers in its own A.R.
Jump and link: jump to the instruction of called procedure and put address of next instruction (return address) into register RA (the return address register).
The called procedure:
1. Copies return address from RA into its A.R.'s return address field.
2. May save some registers.
3. May initialize local data.
Static storage allocation:
On procedure returns:
The called procedure:
1. Restores values of saved registers.
2. Jump to address in the return address field.
The calling procedure:
1. May restore some registers.
2. If the called procedure was actually a function, put return value in an appropriate place
Dynamic storage allocation for STACK:
On procedure returns
The called procedure:
1. Restore values of saved registers if needed.
2. Loads return address into special register RA.
3. Restores SP (SP := FP).
4. Restore FP (FP := saved FP).
The calling procedure:
1. May restore some registers.
2. If it was in fact a function that was called, put return value into an appropriate place.
Activation tree:
Use a tree structure to record the changing of the activation records.
Example:
Dynamic storage allocation for HEAP:
Storages requested from programmers during execution:
Example:
Issues: 
1. Garbage collection.
2. Segmentation.
3. Dangling reference.

Compiler Design

EasyExamNotes.com covered following topics in Compiler Design.

Python Programming ↓ 👆
Java Programming ↓ 👆
JAVA EasyExamNotes.com covered following topics in these notes.
JAVA Programs
Principles of Programming Languages ↓ 👆
Principles of Programming Languages
EasyExamNotes.com covered following topics in these notes.

Practicals:
Previous years solved papers:
A list of Video lectures References:
  1. Sebesta,”Concept of programming Language”, Pearson Edu 
  2. Louden, “Programming Languages: Principles & Practices” , Cengage Learning 
  3. Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. 
  4. E Horowitz, "Programming Languages", 2nd Edition, Addison Wesley

    Computer Organization and Architecture ↓ 👆

    Computer Organization and Architecture 

    EasyExamNotes.com covered following topics in these notes.

    1. Structure of desktop computers
    2. Logic gates
    3. Register organization
    4. Bus structure
    5. Addressing modes
    6. Register transfer language
    7. Direct mapping numericals
    8. Register in Assembly Language Programming
    9. Arrays in Assembly Language Programming

    References:

    1. William stalling ,“Computer Architecture and Organization” PHI
    2. Morris Mano , “Computer System Organization ”PHI

    Computer Network ↓ 👆
    Computer Network

    EasyExamNotes.com covered following topics in these notes.
    1. Data Link Layer
    2. Framing
    3. Byte count framing method
    4. Flag bytes with byte stuffing framing method
    5. Flag bits with bit stuffing framing method
    6. Physical layer coding violations framing method
    7. Error control in data link layer
    8. Stop and Wait scheme
    9. Sliding Window Protocol
    10. One bit sliding window protocol
    11. A protocol Using Go-Back-N
    12. Selective repeat protocol
    13. Application layer
    References:
    1. Andrew S. Tanenbaum, David J. Wetherall, “Computer Networks” Pearson Education.
    2. Douglas E Comer, “Internetworking with TCP/IP Principles, Protocols, And Architecture",Pearson Education
    3. KavehPahlavan, Prashant Krishnamurthy, “Networking Fundamentals”, Wiley Publication.
    4. Ying-Dar Lin, Ren-Hung Hwang, Fred Baker, “Computer Networks: An Open Source Approach”, McGraw Hill.