Lesson 03

brickcompetitiveΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 6 μήνες)

167 εμφανίσεις

Brickcompetitive_3d09a647
-
7346
-
46d8
-
B9b7
-
614eb6f7129f.Docx


CTC Spring 2010

Page
1

of
4


Chapter

3

Exercise #
2



Advantages and disadvantages of Memory Management Schemes



Single
-
user contiguous

o

Jobs are limited to available memory size and if it doesn’t fit, it doesn’t get executed

o

Doesn’t support multiprogramming or networking

o

Not
cost
-
effective because CPU is often idle wasting time sitting pretty



Fixed partitions

o

Allows several programs to be in the memory at the same time so CPU is seldom idle

o

Partitions are indivisible units and
causes internal fragmentation

o

The size of partitio
ns are arbitrary and reconfiguring the
m is painstakingly cumbersome



Dynamic partitions

o

Gets rid of internal fragmentation

o

Uses combinations of first
-
fit and best
-
fit algorithms

o

Even with best
-
fit, system wastes time searching rest of the table for ideal fi
t

o

Causes external fragmentation when new job is smaller than replaced job



Relocatable dynamic partitions

o

Compaction is introduced eliminating
internal and
external fragmentation

o

Compaction is an overhead process because nothing else can be done until it

s
done

o

Jobs are limited to memory size



Paged

o

Allows jobs to be allocated in a non
-
contiguous fashion and more jobs can fit in memory

o

Solves the need for compaction

o

Need more tables which causes OS to be more involved, increasing overhead

o

Internal
fragmentation returns but only on the last page of the job

o

Jobs limited to memory size



Demand paged

o

Job no longer have to have their entire program loaded in memory before processing

o

Jobs no longer limited to memory size

o

Allows for more efficient use of me
mory

o

Allows for
large
-
scale multiprogramming and time
-
sharing

o

Requires more OS involvement increasing overhead

o

Trashing is introduced which can further increased overhead

o

More overhead is required with page interrupts

o

Paging hardware is needed for this sch
eme to work



Segmented

o

Memory is allocated in dynamic manner

o

Solves internal fragmentation in pages scheme but

o

External fragmentation returns

o

Compaction is needed from time to time

o

More steps required in managing segments in secondary storage

Brickcompetitive_3d09a647
-
7346
-
46d8
-
B9b7
-
614eb6f7129f.Docx


CTC Spring 2010

Page
2

of
4




Segmented/dema
nd paged

o

Eliminated most problems associated with segmentation (compaction, external and
secondary storage handling) because the pages are now of a fixed length

o

Large overhead required for the extra tables and timerequired to reference segment
and page tab
les

o

Needs complex hardware required to perform parallel searches

Exercise #
6



Complete with the following page request

in this order
: d c b a d c e d c b a e

a.

Do a page trace analysis with three (3) page frame available for public use
. C
ompute the success
and failure rates. Mark page faults with an asterisk.

b.

Do a page trace analysis with four (4) page frame available for public use. Compute the success
and failure rates. Mark page faults with an asterisk.

c.

Did the result correspond with your intuition?




(A)

Page

Trace Analysis with Three Page Frames Using FIFO

Success Rate:


6/12


50%

Page
Requested

D

C

B

A

D

C

E

D

C

B

A

E

Page Frame
#1

d

d

d

a

a

a

e

e

e

e

e

e

Page Frame
#2

-

c

c

c

d

d

d

d

d

b

b

b

Failure Rate:


6/12


50%

Page Frame
#3

-

-

b

b

b

c

c

c

c

c

a

a

Time
snapshot

1

2

3

4*

5*

6*

7*

8

9

10*

11*

12

(B)

Page Trace Analysis with
Four

Page Frames Using FIFO

Success Rate:


6/12


50%

Page
Requested

D

C

B

A

D

C

E

D

C

B

A

E

Page Frame
#1

d

d

d

d

d

d

e

e

e

e

a

a

Page Frame
#2

-

c

c

c

c

c

c

d

d

d

d

e

Failure Rate:


6/12


50%


Page Frame
#3

-

-

b

b

b

b

b

b

c

c

c

c

Page Frame
#4

-

-

-

a

a

a

a

a

a

b

b

b

Time
snapshot

1

2

3

4

5

6

7
*

8
*

9
*

10
*

11
*

12
*

Brickcompetitive_3d09a647
-
7346
-
46d8
-
B9b7
-
614eb6f7129f.Docx


CTC Spring 2010

Page
3

of
4


(C)

The increased number of page frames in table b did not improve the success/failure rate. This is
counter
-
intuitive because you’d think there would be less page faults or interrupts because
there’s one more available page frame in Table B as compared with only three page frames in
Table A.

Exercise #
7



Given that main memory has three page frames for
public

use and that a program
requests pages in the following order: a b a c a b d b a c d



(C)

Which is better and why? Can you make a general
statement from this example? Why or why
not? For this particular example, FIFO on Table A performed better but not by much. The order
of page requests is somewhat arbitrary, if not random and do not necessarily reflec
t neither
actual usage nor usual usage.

As a matter of personal opinion, I believe that it is a virtual
impossible to predict how one system can predict just how a computer system is used exactly
because the use of such systems varies whether they be used commercially or not. In short, I
canno
t make a general statement regarding which page
removal scheme

is better based solely
on the success and failure ratios of the examples above.


(A)

Page Trace Analysis with Three Page Frames Using FIFO

Success Rate:


9/11


81.82%

Page
Requested

A

B

A

C

A

B

D

B

A

C

D


Page Frame
#1

a

a

a

a

a

a

d

d

d

d

d


Page Frame
#2

-

b

b

b

b

b

b

b

a

a

a


Failure Rate:


2/11


18.18%

Page Frame
#3

-

-

-

c

c

c

c

c

c

c

c


Time
snapshot

1

2

3

4

5

6

7*

8

9*

10

11


(B)

Page Trace Analysis with Three Page Frames Using
LRU

Success Rate:


8
/11


72
.
73
%

Page
Requested

A

B

A

C

A

B

D

B

A

C

D


Page Frame
#1

a

a

a

a

a

a

a

a

a

a

a


Page Frame
#2

-

b

b

b

b

b

b

b

b

b

d


Failure Rate:


3
/11


27.27
%

Page Frame
#3

-

-

-

c

c

c

d

d

d

c

c


Time
snapshot

1

2

3

4

5

6

7
*

8

9

10
*

11
*


Brickcompetitive_3d09a647
-
7346
-
46d8
-
B9b7
-
614eb6f7129f.Docx


CTC Spring 2010

Page
4

of
4



(E)

In my opinion, I believe that the FIFO page removal
scheme is the best solely because it is the
simplest and most straightforward of the three. Even after looking at the page tracing analysis at
the example above, the unpredictable nature of how a computer system is and would be used is
enough to make me he
sitate of choosing neither LRU not MRU because these schemes are
based on locality or frequency with which page are requeste
d. I
nstead of trying to predict

something which is virtually unpredictable, I would rather choose another route or alternative
and t
hink outside of the predicting box. For example, I would I would combine FIFO with the
concept of cache memory so that I would have a simple algorithm while at the same time, taking
advantage of locality/frequency factor having that cache memory lying arou
nd.

Exercise #
9



Given main memory with four (4) page frames for public use

a.

FIFO
: Page frame 2

b.

LRU
: Page frame 0

c.

MRU
: Page frame 3

d.

LFU
: Page frame 0




(D)


Page Trace Analysis with Three Page Frames Using
M
RU

Success Rate:


8/11


72.73%

Page
Requested

A

B

A

C

A

B

D

B

A

C

D


Page Frame
#1

a

a

a

a

a

a

a

a

a

A

a


Page Frame
#2

-

b

b

b

b

b

d

b

b

b

b


Failure Rate:


3/11


27.27%

Page Frame
#3

-

-

-

c

c

c

c

c

c

c

d


Time
snapshot

1

2

3

4

5

6

7
*

8
*

9

10

11
*