作者dendrobium (石斛蘭)
看板Grad-ProbAsk
標題Re: [理工] [OS] CPU Scheuduling
時間Sun Mar 7 23:07:16 2010
※ 引述《Lautreamont (Maldoror is dead)》之銘言:
: Consider a preemptive priority scheduling algorithm based on
: dynamically changing priorities. Larger priority numbers imply
: higher priority. When a process is waiting for the CPU (in the
: ready queue, but not running), its priority changes at a rate α;
: when it is running, its priority changes at a rate β. All processes
: are given a priority of 0 when they enter the ready queue.
: The parametersαandβcan be set to give many different scheduling
: algorithms.
: a. What is the algorithm that results fromβ>α> 0?
: b. What is the algorithm that results from α<β< 0?
: Answer:
: a. FCFS
假設有 p1 到 pn 共 n 個 process 依序進入 ready queue
p1 先取得執行 且 β>α> 0
所以 p1 的 privrity > p2 > p3 > ... > pn (note that 新進來的是 0)
因此 p1 會先執行完 , 然後接著 p2 以此類推
所以是 FCFS
: b. LIFO
假設有 p1 到 pn 共 n 個 process 依序進入 ready queue
p1 先取得執行 且 β< 0
則在 p2 進入 ready queue 時因為 p2 的 privrity = 0 > p1 ( p1 的是負的 )
所以 p2 取得 CPU 執行 , 以此類推
越晚進入 ready queue 的 process , 它的 privrity 會越高
因此是 LIFO
--
人家可不是為了你才這樣做的哦!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.198.35.85
推 Lautreamont:瞭解了 感謝! 03/07 23:11
推 holik0123:對了今天OS可插隊的SJF應該是看BURST TIME 進行插隊? 03/07 23:23
推 Lautreamont:preemptive的SJF 應該就是SRJF 所以在process到達時 03/07 23:29
→ Lautreamont:檢查各process剩餘的時間 03/07 23:30