You are on page 1of 37

222:

( Operating Systems: Internals and


Design Principles, 6/E, William Stallings)

8





.

.
.
UNIX Solaris.
Linux.
Windows.

O
:
O

() .


.
T
( )
.
.



,

.


,

.
Fotheringham
1961
.
5

, ..
.


(
..
), .

,

.

(page fault) (segment fault),
.

(resident set).


2
..


.
/ .
, ..
.

,

7
.



.

.


.


.

,
8
.


.
.

.
.

8.2


.
9

,
.
,
, .


,

(thrashing).

70


.
10

(principle of locality)


.
,


.
,
,

thrashing.

.
11



.
12



,
:

/ .
..
/
.

13

O

.

:
T bit /
.
T bit (modified bit)
.
T bit (referenced bit)
.
T, bits bits ,
14

15

16


,
.
T 1
( 1 ) .
!

:
,
( ).

.


.
(
)
17
.

, ,

18

19




.
,
.



(inverted page tables).
20

PowerPC, UltraSPARC,
IA-64.

(hash value)
(hash function).

.

( ),
.

.


,
(1-2 ).

21



.

.

.
.


.

Bits .

.

.
.

22

23



,
:

.
.



(translation
lookaside buffer).

.
24



.
,


.
, (
)
.
,
.
,

.

25

26

27


,

.


.
(associative mapping)

.
T (hit ratio)
n

.
28

vs.

29

30

A
.
(

).
A .

,
.


2 1 K 4 K (
256 ).
31

,

.


.
,

.

.


,
( P )
0 .
32

33

34


, .

.
.
,

.

, .


.
.


bits
(protection rings).

35

:

.

( , ).

.

:
bit
.
bit

.
,
, /.
bits .

36

37

38


( ).
,

.
,
.
,
( ,
).
,
( ,
39
, ).

40

41


,
.

.
,

.

42

43

.
UNIX Solaris.
Linux.
Windows.

44



.

.

.


.
(.. DOS)
.. .
45

(fetch
policies).

(placement policies).
(replacement
policies).

(resident set management).

(cleaning policies).

(load control).

.
46



.
K
..
:
,

,
(process
switching), (

/ ).


,
,

.
47




.
:
(demand paging).
(prepaging).

48






,
.
,
,
.
49

.

,

,
.
,

.

.
50







.
M


.
51




.
O
(principle of optimality):

.
, ,

,
.

.
52


,
.

.

.. , :
..
.
.

bit
/

.
53

(random page
replacement).
(optimal).
(not
recently used, NRU).

(least recently used, LRU).
, (first in
first out, FIFO).
(Clock).

54



,
.
5 (1-5)
3 .
,
:
23 2152453252.
55


.



.

.


.
56



.
.
T
.
.
, ,
.

57

3
, .

58



(
, 20 msec).
O
,

bits

59
.


.
M ,

.
O
.



/ , .
60


LRU

LRU
.
4
.
61


.

.
( )

.

/
.
,
.

62


FIFO

FIFO 6
.
LRU
2 5
, FIFO
63
.

Belady

FIFO



.



3
4.
5 ,

: 01
2301401
234.
3
9
4 10.

Belady 1969.

0 1 2 3 0 1 4 4 4 2 3 3
0 1 2 3 0 1 1 1 4 2 2
0 1 2 3 0 0 0 1 4 4
0 1 2 3
0 1 2
0 1
0

3
2
1
0

3
2
1
0

4
3
2
1

0
4
3
2

1
0
4
3

2
1
0
4

3
2
1
0

4
2
2
1
64


bit .
, bit
1.
, ,
bit 1.



.
,
.
,
0 bit
.
1 bit 0.
1 bit ,
bits 0
65
( ).

FIFO
bit .
bit 1
.

2 5.
(second chance). 66

67

68

69

70

71

FIFO
.. VAX VMS.
,

(buffers),
(

).
,
(
) .




-, /.
72



,
.

() (cache).

cache

( 20%

cache).
73



..

.

.
,

.
, ,


.

74

(fixed allocation).


.
..

.
,
.

(variable allocation).

,
,

.

75




:
(local replacement policy)

,
(global replacement policy)

,
.

76


,
.
,

.
,
.
,


.
77

(
..).
.. .
, ..


.
, ..

.
:

.
78

,
(
)
.
,
.
, ..


.


79
.




(working set model)


.

(page fault frequency)




.
80

81




.
:
(demand
cleaning policy).
(precleaning policy).



cache ( 72).
82

83



.





.
84


(load control)

,
.

:
,

.

,

.
85

86


..
,



.


..
87
6 .


1
.

.

.


,
/ .


.

.

88


2

.


.


.

.


.

SPN.
89

.
.

UNIX Solaris.
Linux.
Windows.

90

Unix
Unix ,

.
Unix
.
Unix (SVR4 Solaris)
.
Unix
.
91

92

93

94

95



.

.

96

97

, bit 0.

, bit 1.
bit
0.
,
.
bit 1,

.
bit 0

.

98




(
).
(

).

..


.99


Unix


.

.


(lazy buddy)

.
Unix


100
.


Lazy Buddy
Ni = 2i.
Ai = 2i
t .
Gi = 2i

.
Li = 2i

.

101


Lazy Buddy

102


.
.
UNIX Solaris.

Linux.
Windows.

103

Linux

Unix .

.
(page directory)
.

(middle page directory)

.


.

.
104

105



.
bit
8 bits
.
, Linux
.
0
.
,


106
.

.
.
UNIX Solaris.
Linux.

Windows.

107

Windows


4-64 (.. Intel
AMD64 4 Intel Itanium
8).
32 bits,
32 bits, 4 GB.
Windows,
2 GB .

3 GB, .
108

32 bits

109


,
2 GB.

64 ,
.
3
:
,
.
,
(.. ).
,
(
110
).


Windows
, .
,

, .




(

).
111

You might also like