[理工] OS同步和死結幾個問題

作者: j897495 (咪咪)   2014-12-17 14:55:07
(1)Can busy-waiting be eliminated in such implementation?
答案是NO 因為確保Semaphore值之存取視為C.S.設計
而C.S.之entry section是利用Busy-waiting方法設計
我的疑問是
Semaphore不是也有Non Busy-waiting的方法嗎
如此不就可以避免了?
(2)
Consider a system consisting of types A and B being shared
by n processes P1,P2....Pn,Resources can be requested and
released by processes only one process at a time.A process
Pi(1<=i<=n) may request at most Maxi,A and Maxi,B>=1,However
a process Pi cannot be allocated any instance of resources of
type B until it has been allocated Maxi,A instances of types A
What is the minimum number of instances of resources of typeA
and typeB to guarantee that the system is deadlock free?
Ans:
m>=Maxi ,1<=i<=n
m>sigma(1 to n)Maxi-n
這兩點可以deadlock free
A:max{Maxi,A for 1<=i<=n,Sigma(1 to n)Maxi,A -n+1
B:同上A換B
這題我懂上面兩個條件是定理來的
但A和B我就不懂為什麼
且這個答案有B要等A分派完嗎?
(3)In a pure demand paging,some pages of a process are kept in
the main memory prior to the process execution
為什麼答案是錯呢
demand paging不就是載入一部分到memory 另一部分還留在DISK
發生了page fault後再去Disk裡面找來置換嗎?
問題很多 希望幫忙解答 謝謝
作者: A4P8T6X9 (殘廢的名偵探)   2014-12-17 15:15:00
1.思考看看為什麼V()跟P()不會一起執行 3.他有 prior
作者: j897495 (咪咪)   2014-12-17 20:05:00
謝謝第一題懂了!所以第三題是之後才load進去嗎
作者: qoojordon (穎川琦)   2014-12-17 20:12:00
第三題的敘述可能要有prepaging機制的demand paging會比較好 ?

Links booklink

Contact Us: admin [ a t ] ucptt.com