[理工] [OS] 99交大資聯OS第19題
19.Consider that a system scheduls three processes P1,P2,P3 using Round-robin
with time quantum=2 units of time. These three processes arrive in the order
P1,P2,P3, all ready at time 0. The three processes share a resource R, which
is protected by a mutex lock. The first process P1 runs 3 units of time, block
the resource R 3 units of time,unlocks this resource,and then runs 1 unit of
time before it completes. Let this execution of P1 be denoted by {3,R(3),1}.
The execution of the second process P2 and the third process P3 are denoted by
{2,R(1),3} and {2,R(2),2}, respectively. Let waiting queues be FIFO. which
one(s) of the following is(are) true?
A. The total number of context switches is not less than 9.
B. T2 has the longest turnaround time.
C. Decreasing P1's execution time from {3,R(3),1} to {3,R(1),1} reduces P2's
turnaround time.
D. Increasing P1's execution time from {3,R(3),1} to {4,R(3),1} reduces P2's
turnaround time.
答案給ACD
但我自己算是只有A對 @@
原本:
| P1 | P2 | P3 | P1 | P2 | P3 | P2 | P1 |
time 0 2 4 5 6 7 8 9 11 12 13
^^^ ^^^^^^^^^^^^^^^^
R(1) R(2) R(3)
time4~5 P2執行R(1)
time6~8 P3執行R(2)
time8~11 P1執行R(3)
(C)選項的結果和原本一樣,P2的turnaround time沒變
(D)選項: P2的turnaround time增加
| P1 | P2 | P3 | P1 | P2 | P3 | P2 | P1 |
time 0 2 4 6 8 10 12 13 14
不知道我哪裡算錯..
有高手可以幫我解答嗎...
感恩
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.34.133.127
→
01/17 19:35, , 1F
01/17 19:35, 1F
→
01/17 19:52, , 2F
01/17 19:52, 2F
→
01/17 20:05, , 3F
01/17 20:05, 3F
→
01/17 20:06, , 4F
01/17 20:06, 4F
→
01/17 20:06, , 5F
01/17 20:06, 5F
→
01/17 20:34, , 6F
01/17 20:34, 6F
→
01/17 20:34, , 7F
01/17 20:34, 7F
→
01/17 20:49, , 8F
01/17 20:49, 8F
→
01/17 20:51, , 9F
01/17 20:51, 9F
→
01/17 21:01, , 10F
01/17 21:01, 10F
※ 編輯: dacvidania 來自: 114.34.133.127 (01/17 21:06)
→
01/17 21:19, , 11F
01/17 21:19, 11F
推
01/17 22:29, , 12F
01/17 22:29, 12F
→
01/17 22:29, , 13F
01/17 22:29, 13F
→
01/17 22:30, , 14F
01/17 22:30, 14F
→
01/17 22:31, , 15F
01/17 22:31, 15F
→
01/17 22:31, , 16F
01/17 22:31, 16F
→
01/17 22:32, , 17F
01/17 22:32, 17F
→
01/17 22:33, , 18F
01/17 22:33, 18F
→
01/17 22:40, , 19F
01/17 22:40, 19F
→
01/17 22:42, , 20F
01/17 22:42, 20F
→
01/17 22:44, , 21F
01/17 22:44, 21F
→
01/17 22:44, , 22F
01/17 22:44, 22F
→
01/17 22:44, , 23F
01/17 22:44, 23F
→
01/17 22:46, , 24F
01/17 22:46, 24F
※ 編輯: dacvidania 來自: 114.34.133.127 (01/17 23:18)
→
09/11 14:09, , 25F
09/11 14:09, 25F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):