Memory Management & Virtual Memory
Memory Management & Virtual Memory
OPERATING SYSTEMS
MEMORY MANAGEMENT – 1
Memory
Management
Nucleus
1.1 Relocation :
Physical Division :
Disadvantages:
2. VIRTUAL MEMORY
Program Physical
Addresses: Memory Locations:
Address Space Memory Space
Or Name Space M
N Address
Seen by Map Actual
Programmer f Computer
Configuration
f : N → M
f (a) = B + a
Protection :
Physical
Memory
PROGRAM BASE REGISTER
ADDRESS B
n
B+a
LIMIT REGISTER
limit
B. PAGING
FUNCTION 1:
MS LS
Address: 8
0
Enough bits for Page number 9bits=512
entire Virtual words/page
Memory Word Number
P’
P’ + w =
physical
adrs
Formally,
f)a) = f(p,w) = p’ + w
Example:
Z Z Z W :
=3xZ+w
ii. Put disc page adres in page table AND have a present
bit: if bit is set take adrs as main memory adrs;
otherwise Adrs is location of page on disc.
12
This takes too long using the normal machine code instrns.
Associative store
Page 0 7 p w Program
Adrs 1 1 address
Reg’s 2 2 3 243
-PAR 3 6
4 5 Simultaneous comparison
*5 3* with all PARs to give
: PAR no.
: P’ w Memory
5 243 location
n-1
2. Explain the term Relocation and discuss why it is not feasible for the programmer
to use absolute physical addresses. Why does the MMS need to compact small
non-contiguous areas of memory?
3. Explain the term Protection and discuss its two main aspects.
4. What are the differences between ‘logical’ and ‘physical’ organisation of memory.
6. With the aid of diagrams explain how the Base and Limit registers are used by the
CPU to provide relocation and protection. Comment on an alternative use of the
Limit register and discuss its advantages.
7. Explain the terms Page and Frame distinguishing between them and commenting
on the use of ‘active’ and ‘inactive’ pages.
8. What are the two main functions of the paging mechanism? Using diagrams
explain how the first function is performed.
9. Explain how getting pages from disc is handled by MMS. What does a ‘page
turning’ algorithm do?
10. What are the four main steps in implementing the address-mapping operation?
Discuss and point out why special hardware page addressing facility is required.
11. Suggest two alternative hardware page-addressing methods and contrast their
advantages and disadvantages.
12. What are PAR and Associative Store? Explain using diagrams the page-
addressing mechanism which rely on these two facilities.
13. For large memory systems it becomes too expensive to operate the scheme in
Q12. Using diagrams develop a compromise.