Top Banner
1 Address binding, Dynamic loading Storage Management
32
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 31 address binding, dynamic loading

1

Address binding, Dynamic loading

Storage Management

Page 2: 31 address binding, dynamic loading

9CM402.31 2

HOME PREVIOUS TOPIC NEXTPREVIOUS QUESTION PAPERS FOR OSCPP TUTORIALS

Page 3: 31 address binding, dynamic loading

3

Recap

In the last class, you have learnt

• Recovery from Deadlock

Page 4: 31 address binding, dynamic loading

4

Objectives

On completion of this period, you will be able to

Know about

• Storage management

• Address binding

• Dynamic loading

Page 5: 31 address binding, dynamic loading

5

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

Page 6: 31 address binding, dynamic loading

6

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.

Page 7: 31 address binding, dynamic loading

7

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

Page 8: 31 address binding, dynamic loading

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

Page 9: 31 address binding, dynamic loading

9

Multistep Processing of User Program

Fig - 2

Page 10: 31 address binding, dynamic loading

10

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

Page 11: 31 address binding, dynamic loading

11

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

Page 12: 31 address binding, dynamic loading

12

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

Page 13: 31 address binding, dynamic loading

13

Address Binding

• Binding of instruction and data to memory

address can be done at

– Compile time

– Load time

– Execution time

Page 14: 31 address binding, dynamic loading

14

Page 15: 31 address binding, dynamic loading

15

Page 16: 31 address binding, dynamic loading

16

Page 17: 31 address binding, dynamic loading

17

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

Page 18: 31 address binding, dynamic loading

18

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

Page 19: 31 address binding, dynamic loading

19

Page 20: 31 address binding, dynamic loading

20

routine( ){ ------- ; ------- ; ------- ;}

Memory• main( )

{

---- ;

---- ;

routine( );

---- ;

}

// routine is called dynamically

Dynamic Loading - Example

Secondary storage

Page 21: 31 address binding, dynamic loading

21

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

Dynamic Loading

Page 22: 31 address binding, dynamic loading

22

• No special support from the operating

system is required

• Implemented through program design

• Operating system provides library

routines to implement dynamic loading

Dynamic Loading

Advantages

Page 23: 31 address binding, dynamic loading

23

Summary

In this class, you have learnt

• Storage Management

• Address binding

• Dynamic loading

• Advantages of dynamic loading

Page 24: 31 address binding, dynamic loading

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?

Page 25: 31 address binding, dynamic loading

25

Quiz

1. Memory is a large array of

a) Words

b) Registers

c) Bits

d) None

Page 26: 31 address binding, dynamic loading

26

Quiz

2. Address in source program is address

a) Relocatable

b) Symbolic

c) Absolute

d)None

Page 27: 31 address binding, dynamic loading

27

Quiz

3. Compiler binds symbolic address to _________

address

a) Absolute

b) Symbolic

c) Relocatable

d) None

Page 28: 31 address binding, dynamic loading

28

Quiz

4. Loader binds relocatable address to ________

address

a) Absolute

b) Symbolic

c) Relocatable

d) None

Page 29: 31 address binding, dynamic loading

29

Quiz

5. All routines are kept on disk in a ______ load

format

a) Relocatable

b) Symbolic

c) Absolute

d) None

Page 30: 31 address binding, dynamic loading

30

Quiz

6. Special support from the operating system is

required

a) Yes

b) NO

Page 31: 31 address binding, dynamic loading

Other subject materials

• Web designing

• Micro processors

• C++ tutorials

• java

home

Page 32: 31 address binding, dynamic loading

32

Quiz

7. Routine is not called until it is required in

dynamic loading

a) True

b) False