Re: [理工] [OS]-CPU Scheuduling
※ 引述《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
推
03/07 23:11, , 1F
03/07 23:11, 1F
推
03/07 23:23, , 2F
03/07 23:23, 2F
推
03/07 23:29, , 3F
03/07 23:29, 3F
→
03/07 23:30, , 4F
03/07 23:30, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):