Featured Posts

Storage Management in Programming Language

It is an act of managing computer memory.  In simpler terms is a way to allocate memory to a program when program calls for it and deallocate it when it is no longer in use.
            We have different ways to allocate or deallocate a memory, one among-est them is garbage collection and deallocation of computer memory resources for a program i.e it is explicit control.
The goals of systems storage management are :-
  • To provide memory space to enable several processes to be executed parallely.
  • To protect each program resources.
  • To share memory space between processes.
  • To make the memory space transparent to the programmer.
  • To make the memory space transparent to the programmer.
  • To provide memory space to store parameter.
Storage management system on multitasking system usually deal with following :-
  1. Relocation :- Basically in virtual memory, a program can be switched back and out of the main memory and RAM memory so, it is not possible for a program to always store in the same position of memory, so storage management must have to handle memory referenced in the code of program so that they always point to the right location.
  2. Protection :- A process can not refer to the memory of another process without permission.  This means, no program interfere the other without the knowledge of the running program.
  3. Logical Organization :- Program can be divided in modules some of them could be shared between different programs.  Some are meant only to be read and some can be write.  So, storage management is responsible for handling this logical organization, which differs from physical linear address space.

# Major Run Time Elements Requiring Storage :-
          A program is always looked or viewed in terms of storage of data and translated programs and the executable code which is generated it totally depend on storage allocation method.  Even a small change in language can lead to large changes in the architecture of the compiler and complexity of language.
        The major programs and data element requiring storage during program execution :-
  1. Code segment for translated user programs :- A program either in machine language code or in some intermediate form requires a great amount of space in memory.
  2. System run time program :- These are the set of programs which need to be run alongside of the program in order to support them.  They are generally in the form of machine independent codes rather than in intermediate form.
  3. User defined data structure and constant :-  A space for user data has to be allocated for all data structure created by users.
  4. Subprogram return point :- A subprogram can be call from anywhere with in a program, so internally generated sequence control into such as return point must be allocate storage.  The storage of these requires either only single location, a central stack.
  5. Referencing environment :- All the referencing environment require referencing environment require certain amount of space.
  6. Temporaries in expression evolution :-> Expression evaluation requires the system defined temporary storage for the intermediate result of evaluation. For example in  X = Y + Z + A, Z + A requires temporary storage.
  7. Temporaries in parameter transmission :->  When a subprogram is called, a list of actual parameters must be evaluated and the resulting values has to be stored in temporary storage until evaluation or the entire list is complete for all parameters.
  8. Input-output buffers :- Generally input and output to anything are work through buffers, where data are stored in between the data is actually binds with the value of the variable.
  9. Miscellaneous system data  :-  A system data is always used in implementation of every language they contains, tables, status information for input-output and various miscellaneous pieces of information Beside the data and program element requiring storage, various operations may require storage to be allocated or freed.  The following are the major operations.
  10. Subprograms call and return operations :- The allocation is need to be done for various thing at subprogram call, such as activation record, local referencing environment and return operations requires freeing of storage.
  11. Data structure creation and destruction :- In a language provide a feature i.e allow creation of data structure at different points which is differ from the space allocated at entry of a program.  For example malloc in C and freeing of space can be done by free in C.
  12. Component insertion and deletion operation :- If a language provide feature to insert and delete component of a data structure, then allocation and deallocation has to be done at run time.

# Programmer And System Controlled Storage Management :-
      C allows extensive programmer controlled over storage via malloc and free, which allocate and free storage for programmer defined data structures.
       However there are many languages which doesn't provide the features and they are system controlled storage management.
-> Advantages of programmer controlled storage management :-
         A programmer whenever required i.e can determine at what point exactly the storage is required so can use allocation and deallocation at better efficiency.
-> Disadvantage of programmer controlled storage management :-
  • Burden on programmer and may interfere with necessary system control.
  • May lead to subtle errors or loss of access to available storage.
  • May interfere with system-controlled storage management.
 # Advantage of system controlled storage management :-
  • Reuse of some location for different data structures.
  • Not have to specify maximum data structure size.
  • Reduce burden.
  • Garbage is automatic.
 # Difference between programmer and system controlled storage management :
  • In programmer controlled, programmer has explicitly control.  While in system controlled, storage is controlled by system itself.
  • Programmer controlled language is more prone to errors.
  • Programmer defined may impose extra burden over programmers.
  • A programmer may interface with necessary system controlled management.
  • A programmer controlled has better efficiency because system will never know when is the use of a variable or not, so is not able to freed up or allocate the storage at it will.
Storage Management in Programming Language
Programming Languages Concepts 
Subprogram Sequence Control in Programming language. 
Structured Sequence Control in Programmig language 
Sequence Control with in Statements 
Implicit and Explicit sequence Control 
Difference between C language and C++ language.

Post a Comment


www.posthatke.com. Powered by Blogger.

Google+ Followers

Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com