Storage organization (Run Time Memory Management)

1. Subdivision of Run-Time memory
  • The compiler demands for a block of memory to operating system. The compiler utilizes this block of memory executing the compiled program. This block of memory is called run time storage.
  • The run time storage is subdivided to hold code and data such as, the generated target code and Data objects.
  • The size of generated code is fixed. Hence the target code occupies the determined area of the memory. Compiler places the target code at end of the memory.
  • The amount of memory required by the data objects is known at the compiled time and
  • hence data objects also can be placed at the statically determined area of the memory.
Typical subdivision of run time memory into code and data areas
  • Stack is used to manage the active procedure. Managing of active procedures means when a call occurs then execution of activation is interrupted and information about status of the stack is saved on the stack. When the control returns from the call this suspended activation resumed after storing the values of relevant registers.
  • Heap area is the area of run time storage in which the other information is stored. For example memory for some data items is allocated under the program control. Memory required for these data items is obtained from this heap area. Memory for some activation is also allocated from heap area.

2. Activation Records (Most IMP)
Various field of activation record are as follows:
  1. Temporary values: The temporary variables are needed during the evaluation of expressions. Such variables are stored in the temporary field of activation record.
  2. Local variables: The local data is a data that is local to the execution procedure is stored in this field of activation record.
Activation Record
  1. Saved machine registers: This field holds the information regarding the status of machine just before the procedure is called. This field contains the registers and program counter.
  2. Control link: This field is optional. It points to the activation record of the calling procedure. This link is also called dynamic link.
  3. Access link: This field is also optional. It refers to the non local data in other activation record. This field is also called static link field.
  4. Actual parameters: This field holds the information about the actual parameters. These actual parameters are passed to the called procedure.
  5. Return values: This field is used to store the result of a function call.

3. Compile time layout of local data
  • Suppose run-time storage comes in block of contiguous bytes, where byte is the smallest unit of addressable memory.
  • The amount of storage needed for a name is determined from its type.
  • Storage for an aggregate, such as an array or record, must be large enough to hold all its components.
  • The field of local data is laid out as the declarations in a procedure are examined at compile time.
  • Variable length data has been kept outside this field.
  • We keep a count of the memory locations that have been allocated for previous declarations.
  • From the count we determine a relative address of the storage for a local with respect to some position such as the beginning of the activation record.
  • The storage layout for data objects is strongly influenced by the addressing constraints of the target machine.
Storage organization

Download the Android app to get all Government Job Notifications on your Mobile.
Download Now
Important: Please always Check and Confirm the above details with the official Advertisement / Notification.
Previous Post Next Post