Sei sulla pagina 1di 5

Faculty of Computer Science & Information Technology

WXES2113: OPERATING SYSTEMS


Tutorial 3: Memory Management-Virtual Memory

1. List the advantages and disadvantages for each of the memory
management schemes.

a.Paged Memory Allocation
Advantages:
Allows jobs to be allocated in non-contiguous memory locations.
Memory used more efficiently; more jobs can fit.

Disadvantages:
Address resolution causes increased overhead.
Internal fragmentation still exists, though in last page.
Requires the entire job to be stored in memory location.
Size of page is crucial (not too small, not too large).

b.Demand Paging
Advantages:
Job no longer constrained by the size of physical memory (concept of
virtual memory).
Utilizes memory more efficiently than the previous schemes.

Disadvantages:
Increased overhead caused by the tables and the page interrupts.

c.Segmented Memory Allocation
Advantages:
Internal fragmentation is removed.
Disadvantages:
Difficulty managing variable-length segments in secondary storage.
External fragmentation.

d.Segmented/Demand Paged Memory Allocation
Advantages:
Large virtual memory.
Segment loaded on demand.

Disadvantages:
Table handling overhead.
Memory needed for page and segment tables

2. What is the cause of trashing? How does the operating system detect
trashing and what can the OS do to eliminate it?

Thrashing is caused by under allocation of the minimum number of
pages required by a process, forcing it to continuously page fault.
The system can detect thrashing by evaluating the level of CPU
utilization as compared to the level of programming.

3. Given that a main memory is composed of three page frames for public
use and that a program requests pages in the following order:
a b c a b d a b a c d
a. Using FIFO and LRU, page removal algorithms, do a page
trace analysis indicating page fault with () and then compute
the failure and success ratios.
FIFO

Ratio:
Failure :(8/11)*100 = 73%
Success: (3/11)*100 = 27%
F1 a a a a a d d d d c c
F2 b b b b b a a a a d
F3 c c c c c b b b b




LRU





Ratio:
Failure :(6/11)*100 = 55%
Success: (5/11)*100 = 45%

b. Which of the three page removal algorithms is best? Why do
you think so?

LRU is the best because the success ratio is higher.


4. Given that main memory is composed of four page frames for public use,
use the following table to answer all parts of this problem:


a) The contents of which page frame would be swapped out by FIFO?

Page Frame 2

F1 a a a a a a a a a a a
F2 b b b b b b b b b d
F3 c c c d d d d c c
b) The contents of which page frame would be swapped out by LRU?

Page Frame 0

c) The contents of which page frame would be swapped out by MRU?

Page Frame 3


5. A system receives a series of page references in the following order:
1, 1, 3, 5, 2, 2, 6, 8, 7, 6, 2, 1, 5, 5, 5, 1, 4, 9, 7, 7

The system has five page frames. If all of the frames are initially empty,
do a page trace analysis indicating page faults with (), and calculate the
number of page faults using each of these algorithms.


i) FIFO


Ratio : Faults :(11/20) *100 =55%

ii) LRU

Ratio : Faults :(12/20) *100 =60%
F1 1 1 1 1 1 1 1 8 8 8 8 8 8 8 8 8 8 9 9 9
F2 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 7 7
F3 5 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1
F4 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5
F5 6 6 6 6 6 6 6 6 6 6 4 4 4 4
F1 1 1 1 1 1 1 8 8 8 8 8 5 5 5 5 5 5 7 7
F2 3 3 3 3 3 7 7 7 7 7 7 7 7 4 4 4 4
F3 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1
F4 2 2 2 2 2 2 2 2 2 2 2 2 9 9 9
F5 6 6 6 6 6 6 6 6 6 6 6 6 6 6

Potrebbero piacerti anche