Storage Management

Address binding, Dynamic loading




                                        1
HOME     PREVIOUS TOPIC NEXT
PREVIOUS QUESTION PAPERS FOR OS
CPP TUTORIALS




            9CM402.31             2
Recap

In the last class, you have learnt

• Recovery from Deadlock




                                     3
Objectives


 On completion of this period, you will be able to
  Know about

• Storage management

• Address binding

• Dynamic loading


                                                     4
Primary Memory
• Primary memory is of two types RAM and ROM
• RAM – Random Access Memory
       – Volatile Memory

       – Can be directly accessibly by the CPU

       – Speed of RAM is compatible to Processor speed

       – Capacity is in GB’s

• ROM – Read Only Memory
         – Non Volatile




                                                         5
Storage Management
• Memory is a large array of words or bytes with its
  own addresses
• In Single user operating system entire memory
  belongs to a single process
  Ex. DOS
• In multi user operating system many processes
  share the memory
  Ex. UNIX, Windows NT, Windows 2003 server
  etc.
                                                  6
Storage Management


What is meant by storage management?

• Allocate memory to multiple processes and

  prevents them from overlapping

• Memory is utilized in an efficient manner



                                              7
Instruction Execution Cycle

• Instruction is fetched from memory
• Decoded and may cause operands to be fetched
  from memory
• After executing the instruction on the operands
  the results are stored back in memory

   Start         Fetch             Execute   Halt


                         Fig - 1

                                                    8
Multistep Processing of User Program




              Fig - 2
                                       9
Address Binding

• Program must be brought into memory and placed
  with in a process for it to be run
• Collection of processes on the disk that are waiting
  to be brought into memory for execution - Input
  queue
• A user program will go through several steps before
  being executed as shown in Fig - 2
                                                    10
Address Binding

• Address is represented in different ways during this

  steps

• Address in source program is symbolic (Ex. COUNT)

• Compiler bind these symbolic addresses to

  relocatable addresses such as

  – 14 bytes from the beginning of this module
                                                   11
Address Binding

• Relocatable means that the program image can
 reside anywhere in physical memory
• A linkage editor or a loader bind relocatable
 addresses to absolute addresses ( such as
 74014 )
• Each binding is a mapping from one address
 space to another
                                            12
Address Binding

• Binding of instruction and data to memory
  address can be done at
  – Compile time

  – Load time

  – Execution time




                                              13
14
15
16
Dynamic Loading

• Routine is not loaded until it is called

• All routines are kept on disk in a relocatable
  load format

• Main program is loaded and executed

• A routine needs to call another routine



                                                   17
Dynamic Loading

• The relocatable linking loader is called to load
  the desired routine
• Control is passed to newly loaded routine

• Routine is called into memory only when it is
  needed



                                                     18
19
Dynamic Loading - Example
                             Secondary storage
                               routine( )
     Memory                    {
• main( )                        ------- ;
  {                              ------- ;
     ---- ;                      ------- ;
     ---- ;                    }
     routine( );   // routine is called dynamically
     ---- ;
   }

                                                      20
Dynamic Loading

 Advantages
• Better memory utilization
• Unused routine is never loaded
• Useful when large amounts of code are needed
  to handle infrequently occurring cases
  – Ex. Error routines
  – Although the total program size may be large, the
    portion i.e., used is much smaller
                                                        21
Dynamic Loading
Advantages

• No special support from the operating
 system is required

• Implemented through program design

• Operating system provides library
 routines to implement dynamic loading
                                          22
Summary


 In this class, you have learnt

• Storage Management

• Address binding

• Dynamic loading

• Advantages of dynamic loading


                                  23
Frequently Asked Questions


• What is address binding?

• What is meant by Dynamic loading?

• Explain the concepts of Dynamic loading

• What are the advantages of Dynamic loading?


                                                24
Quiz

1. Memory is a large array of
  a) Words
  b) Registers
  c) Bits
  d) None




                                25
Quiz

2. Address in source program is   address

  a) Relocatable

  b) Symbolic

  c) Absolute

  d)None


                                       26
Quiz


3. Compiler binds symbolic address to _________
      address

  a) Absolute

  b) Symbolic

  c) Relocatable

  d) None
                                              27
Quiz


4. Loader binds relocatable address to ________

        address

  a) Absolute

  b) Symbolic

  c) Relocatable

  d) None
                                                  28
Quiz

5. All routines are kept on disk in a ______ load
  format
  a) Relocatable
  b) Symbolic
  c) Absolute
  d) None


                                                    29
Quiz


6. Special support from the operating system is

  required

  a) Yes

  b) NO



                                              30
Other subject materials

•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home
Quiz


7. Routine is not called until it is required in

  dynamic loading

  a) True

   b) False


                                                   32

31 address binding, dynamic loading

  • 1.
  • 2.
    HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 9CM402.31 2
  • 3.
    Recap In the lastclass, you have learnt • Recovery from Deadlock 3
  • 4.
    Objectives On completionof this period, you will be able to Know about • Storage management • Address binding • Dynamic loading 4
  • 5.
    Primary Memory • Primarymemory is of two types RAM and ROM • RAM – Random Access Memory – Volatile Memory – Can be directly accessibly by the CPU – Speed of RAM is compatible to Processor speed – Capacity is in GB’s • ROM – Read Only Memory – Non Volatile 5
  • 6.
    Storage Management • Memoryis a large array of words or bytes with its own addresses • In Single user operating system entire memory belongs to a single process Ex. DOS • In multi user operating system many processes share the memory Ex. UNIX, Windows NT, Windows 2003 server etc. 6
  • 7.
    Storage Management What ismeant by storage management? • Allocate memory to multiple processes and prevents them from overlapping • Memory is utilized in an efficient manner 7
  • 8.
    Instruction Execution Cycle •Instruction is fetched from memory • Decoded and may cause operands to be fetched from memory • After executing the instruction on the operands the results are stored back in memory Start Fetch Execute Halt Fig - 1 8
  • 9.
    Multistep Processing ofUser Program Fig - 2 9
  • 10.
    Address Binding • Programmust be brought into memory and placed with in a process for it to be run • Collection of processes on the disk that are waiting to be brought into memory for execution - Input queue • A user program will go through several steps before being executed as shown in Fig - 2 10
  • 11.
    Address Binding • Addressis represented in different ways during this steps • Address in source program is symbolic (Ex. COUNT) • Compiler bind these symbolic addresses to relocatable addresses such as – 14 bytes from the beginning of this module 11
  • 12.
    Address Binding • Relocatablemeans that the program image can reside anywhere in physical memory • A linkage editor or a loader bind relocatable addresses to absolute addresses ( such as 74014 ) • Each binding is a mapping from one address space to another 12
  • 13.
    Address Binding • Bindingof instruction and data to memory address can be done at – Compile time – Load time – Execution time 13
  • 14.
  • 15.
  • 16.
  • 17.
    Dynamic Loading • Routineis not loaded until it is called • All routines are kept on disk in a relocatable load format • Main program is loaded and executed • A routine needs to call another routine 17
  • 18.
    Dynamic Loading • Therelocatable linking loader is called to load the desired routine • Control is passed to newly loaded routine • Routine is called into memory only when it is needed 18
  • 19.
  • 20.
    Dynamic Loading -Example Secondary storage routine( ) Memory { • main( ) ------- ; { ------- ; ---- ; ------- ; ---- ; } routine( ); // routine is called dynamically ---- ; } 20
  • 21.
    Dynamic Loading Advantages •Better memory utilization • Unused routine is never loaded • Useful when large amounts of code are needed to handle infrequently occurring cases – Ex. Error routines – Although the total program size may be large, the portion i.e., used is much smaller 21
  • 22.
    Dynamic Loading Advantages • Nospecial support from the operating system is required • Implemented through program design • Operating system provides library routines to implement dynamic loading 22
  • 23.
    Summary In thisclass, you have learnt • Storage Management • Address binding • Dynamic loading • Advantages of dynamic loading 23
  • 24.
    Frequently Asked Questions •What is address binding? • What is meant by Dynamic loading? • Explain the concepts of Dynamic loading • What are the advantages of Dynamic loading? 24
  • 25.
    Quiz 1. Memory isa large array of a) Words b) Registers c) Bits d) None 25
  • 26.
    Quiz 2. Address insource program is address a) Relocatable b) Symbolic c) Absolute d)None 26
  • 27.
    Quiz 3. Compiler bindssymbolic address to _________ address a) Absolute b) Symbolic c) Relocatable d) None 27
  • 28.
    Quiz 4. Loader bindsrelocatable address to ________ address a) Absolute b) Symbolic c) Relocatable d) None 28
  • 29.
    Quiz 5. All routinesare kept on disk in a ______ load format a) Relocatable b) Symbolic c) Absolute d) None 29
  • 30.
    Quiz 6. Special supportfrom the operating system is required a) Yes b) NO 30
  • 31.
    Other subject materials • Web designing • Micro processors • C++ tutorials • java home
  • 32.
    Quiz 7. Routine isnot called until it is required in dynamic loading a) True b) False 32