33
-
Upload
myrajendra -
Category
Documents
-
view
88 -
download
0
Transcript of 33
3
Recap
In the last class, you have learnt
• Dynamic linking
-advantages and disadvantages
• Overlays
-advantages and disadvantages
4
Objectives
On completion of this class, you will be able to
know
• Logical and Physical addresses
• MMU
• Swapping
Logical Vs Physical addressLogical address• Address generated by the CPU
Physical address• Address seen by the memory unit i.e. the one
loaded into memory- address register
Compile –time and Load time address binding methods generate same logical address and physical address
4
Logical Vs Physical address
• Execution time address binding scheme results
in different logical and physical addresses
• Address generated by CPU at execution is
referred as Virtual address
• Logical address space is the set of all logical
addresses generated by program is a logical
address space
5
7
Memory Map Unit (MMU)
• MMU is a hardware device
• Maps virtual address to physical address at run
time
• A simple MMU scheme consists relocation register
• A relocation register is a base register
8
Relocation Register
Memory
Base Register
CPU Instruction
Address
+
BA
MA MA+BA
PhysicalAddress
LogicalAddress
9
Memory Map Unit (MMU)
• Address generated by the CPU are added to
relocation register as shown in previous slide
• Physical address = logical address + contents
of relocation register
• This process is called Dynamic relocation
• The user program deals with logical addresses;
– it never sees the real physical addresses
10
Memory Map Unit
• Example 1:
Logical address = 346
Relocation register = 14,000
Physical address = 346+14000
= 14346
12
Logical address
1800MemoryCPU
14000
Relocation register
Physical address
15800
Dynamic relocation ( MMU )
MMU
+
Example 2
13
Swapping
• A process needs to be in memory to be
executed
• A process can be swapped temporarily out of
memory to a backing store
• Then brought back into memory for continued
execution as shown in next slide
15
Swapping
Backing store
– Fast disk large enough to accommodate copies of all
memory images for all users
– Must provide direct access to these memory images
16
Swapping
• In Multiprogramming environment and round-
robin CPU scheduling
• When time quantum expires
– the memory manager will swap-out the process to
backing store
– and swap-in another process to the memory space
occupied by the swapped-out process
17
• This process continues until all the processes
are executed
• The memory manager swaps the processes
fast enough
• All ways one process is present in memory
Swapping
19
Priority based scheduling
• Another variant of swapping policy
• Higher priority process is swapped-in and lower
priority swapped-out
• Here the variant used is
– roll-in and roll-out
• Example for Priority based scheduling in next
slides
Swapping
27
• Major part of swap time is transfer time
• Total transfer time is directly proportional to the
amount of memory swapped
• Modified versions of swapping are found on
many systems, i.e., UNIX, Linux, and Windows
Swapping
29
Frequently Asked Questions
• Write the differences between logical and physical address space
• Define logical, virtual and physical addresses
• Draw and explain the basic dynamic relocation unit (MMU)
• Explain the concept of swapping
31
2. Address generated by the CPU at compile
and load time
a) Logical
b) Physical
c) Virtual
d) None
Quiz
34
Quiz
5. For ___________scheduling when time quantum
expires the memory manager will swap-out the
process to backing store
a) Round robin
b) Priority
c) FIFO
d) None