Re: [理工] [OS]-政大
※ ()引述《bigrat2 (MrEric)》之銘言:
: Give the follwing variables and their initial values as follows:
: X:integer,initial value is 0
: y:integer,initial value is 23
: m:general semaphore,initial value is 1
: m1:general semaphore,initial value is 0
: For each of the following program,list values possible for x when the
: program terminates. Note that"cobegin P1||P2 ;coend" means P1 and P2
: are executed concurrently, and ":=" is the assignment operator.
: (1)cobegin P(m1);x:=x+1;V(m) || P(m);x=y+1;V(m1) coend
: (2)cobegin V(m1);x:=x+1;P(m) || V(m1);x:=y+1;P(m1); coend
: 答案(1) 25 (2) 1,24 or 25
: 我想請問一下P(m1) V(m1) P(m) V(m)是什麼意思呢?
: 另外(2)的結果是怎麼推算出來的
: 謝謝各位指教
(2)在V(m1)的時候不會進入死結麼?? 答案不太懂位什麼是1,24,25
抱歉學校PPT不方便選字.................指教指教囉
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.18.75.130
推
03/04 10:50, , 1F
03/04 10:50, 1F
→
03/04 10:52, , 2F
03/04 10:52, 2F
→
03/04 10:59, , 3F
03/04 10:59, 3F
→
03/04 11:02, , 4F
03/04 11:02, 4F
→
03/04 11:02, , 5F
03/04 11:02, 5F
→
03/04 11:06, , 6F
03/04 11:06, 6F
→
03/04 11:08, , 7F
03/04 11:08, 7F
→
03/04 11:09, , 8F
03/04 11:09, 8F
→
03/04 11:22, , 9F
03/04 11:22, 9F
→
03/04 11:23, , 10F
03/04 11:23, 10F
→
03/04 11:23, , 11F
03/04 11:23, 11F
推
03/04 11:25, , 12F
03/04 11:25, 12F
→
03/04 11:27, , 13F
03/04 11:27, 13F
討論串 (同標題文章)