作者Asbarla (木頭)
看板CHU_CS96b
標題[作業] Operating_System_Homework6
時間Wed May 19 22:00:06 2010
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.
--
推 supetaco:小當家根本就是毒梟,吃了他料理的人都會出現旗袍妹或是神龍的幻覺
推 LUDWIN:被你一講這小當家團隊很像犯罪集團XXD
→ LUDWIN:主謀小當家,執行雷恩,色誘要員嘟嘟,車手四郎,
→ vopp: 保鑣解師父,顧問十全,政治公關及第,毒窟四川,
→ PsMonkey:樓上兩位真是對仗工整 (y)
【你所不知道的小當家】 民明書坊
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.251.200.33
推 epson0828:頭推! 05/24 00:46