[作業] Operating_System_Homework6
6-1.
The first known correct software solution to the critical-section problem
for two processes was developed by Derek Fisher. The two process, P0 and P1
,shared the following variables:
boolean flag[2]; /*initially fales */
int turn;
do {
flag[i] = TRUE;
while(flag[j]) {
if(turn == j) {
flag[i] = false;
while(turn == j)
;//do nothing
flag[i] = TRUE;
}
}
// critical section
turn = j;
flag[i] = FALSE;
// remainder section
} while(TRUE);
The structure of precess Pi (i == 0 or 1) ;
The other process is Pj (j == 1 or 0) ;
Prove that the algorithm
satisfies all three requirements for the critical-section problem.
6-2.
Explain why interrupts are not appropriate for implementing synchronization
primitives in multiprocessor systems.
6-11.
Show that, if the wait() and signal() semphore operations are not executed
atomically, then mutual exclusion may be violated.
6-21.
Explain why spinlocks are not appropriate for single-processor systems yet
are often used in multiprocessor systems.
6-28.
What is the meaning of the term busy waiting? What other kinds of waiting are
there in an operating system? Can busy waiting be avoided altogether?
Explain your answer.
--
推
,
推
,
→
,
→
,
→
,
【你所不知道的小當家】 民明書坊
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.251.200.33
推
05/24 00:46, , 1F
05/24 00:46, 1F