Professional Documents
Culture Documents
.
.
. Program Counter
.
.
.
(2 ?
. /
.
.
. !
.
.
(3! )( ! !
. (running) $ )(ready
. $
. ) (waiting )(User Mode
. ) (waiting )(Kernel Mode
.
.
. $ !
(4 ! ?
.! )(Deadlock
. !
. ! signal ! '
.wait
. ).(Preemption
.
.
(5 (Test&Set) TSL :
.!
. ).(Busy Wait
. ).(Bounded Wait
.
.
.!
(6 )( External Interrupt
. ! ).(Deadlock
. .
. / / .
. .
.
.
(7 :
. ! .
. ).(Uniprocessor
. .
. .
.
.
(8 ) (Threads :
. ! ! $ ! .
. !
.
. ) (Context !
. .
. .
. .
(9! / Test & Set
:
.
Test & Set . !
.
. Test & Set .
. Test & Set .
. .
. .
(10 3 A,B,C S,R,T :
!
!
.
! C
T
R
T
R
! B
S
T
S
T
! A
R
S
R
S
:
. 3 ' 3.
. .
. .
. .
. .
. .
(11 / ) (Producer / Customer
1 , :
. / .
. ! .
. Space' Times .N
. .Items
. .
. .
(12 :
1200ns Tm
100ns Te TLB
!
2290ns ) (HitRate?
0.1 .
0.8 .
0.9
.
1.1 .
.
.
.
*** 0.9*2400+0.1*1300 =~ 2290
(13 .
) 5K( . ) (segment 12K
' Free-3
:
0'5 K
5'25 K
25'35 K
35'70 K
70'88 K
88'113 K
.
.
.
.
.
.
Free-1
Free-2
Free-3
First Fit
Worst Fit
Best Fit
Next Fit
) Last Fit (
(16 ) (Protection :
. .
. ) (Shared Pages .
. .
.
.
.
(17 ) (Protection
) (Anticipatory Paging:
.
.
.
.
.
.
!
.
.
.
! !.
(41 ?
. .
. :
.
. .
.
.
.
(42 ) (Segmentation :
. .
. .
. , .
. .
.
.
(43! 4 .
' .0 ) (R ) .(M
:
'
2
1
0
3
'
0
1
2
3
60
130
26
20
161
160
162
163
R
0
0
1
1
M
1
0
0
1
' 4
) (Clock ) (Victim:
0 .
1 .
2 .
3 .
.
.
(44 )(
) (:
100K
200K
100K
512K
) C,B,A : !
(A 90K, B 60K , C 10K :
:
4
512K
?
First Fit .
Next Fit .
Best Fit .
Worst Fit .
.
.
4
100K
B
2
200K
1
100K
A' C
(45 / :
. /
. /
.
.
.
.
(46
. ) (
. /
. /
. /
.
.
(47 !
: ' Q " PT " ! P
! Q ! .$
! Priority(P)=Q/PT :
100=Q :! P $ 20' ! 100
' 100/20 = 5! 100'
1 )! ( ! .
:
. / .
. / .
. / .
. / .
. /.
.
(48 '
: user-mode Monitor-mode/Kernel-mode/Supervisor-
.mode
?
. /
. .
. .Interrupt Disable
. .Base and Limit Registers
. .
(49 )?(System Call
. '.kernel
. '.System
. .
. .
. .
4
6
5
3
4
6
2
2
4
1
0
3
process
arrival
burst time
) + ( ,
?First Come First Served FCFS
8.60 :
.4.00 :
8.20 :
.4.60 :
8.60 :
.4.60 :
8.20 :
.4.00 :
.
. .
(55
, :
5
8
2
4
6
5
3
4
6
2
2
4
1
0
3
process
arrival
burst time
) + ( ,
?First Come First Served FCFS
7.60 :
.3.60 :
8.00 :
.3.20 :
7.60 :
.4.00 :
8.00 :
.3.60 :
.
. .
(57 $
P0' ) P1' i P0 0' j 1' P1!(
) TURN' FLAG , FLAG
(FALSE
Process Pi:
#define TRUE 1
#define FALSE 0
;]int FLAG[2
;int TURN
)while(TRUE
{
;FLAG[i]= TRUE
;TURN =j
while ((FLAG[j] ==TRUE ) and TURN == j) {} ; /* meditate */
Critical_Section
;FLAG[i]=FALSE
Non_Critical_Section
:
. )(mutual exclusion
. )(progress
. )(bounded wait
. )(busy wait
.
.
(58 / )(?
Round Robin .
Priority .
FIFO .
Busy Wait .
.
.
(59 !?
FCFS .
(Shortest Seek First) SSF .
SCAN .
C-LOOK .
C-SCAN .
.
(60 , :
15%
:
99.8%
:
/ 10% :
?
.
. /
.
.
.
.!
(61 ! ?
.
. )(Progress
. )(Busy Wait
. )(Bounded Wait
. )(Deadlock
. )(Starvation
(62 ) (Threads !/ ) (Tesk/Process :
.' PC
.' Kernel Kernel Supported Thread' .User Level Thread
. !
.
.
.
(63 ' (Test and Set) TSL?
. !
. )(busy wait
.
.
.
.
(64 signals' Pipes ?UNIX
. .
. .$
. .kill
. "
.
.
(65 ) (Spooling :
.
.
.' Cache
.' CPU Registers
.
.