[理工] 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