fcfs調度算法
The FCFS, which stands for First Come First Serve Scheduling Algorithm, is a non-preemptive scheduling algorithm, which means that if a process once starts executing in the processor, then it cannot be preempted in between the processing. Thus, the concept of priority and urgency is not implemented by this type of algorithm. In the FCFS algorithm, the process gets executed in the same sequence in which they enter the Ready state. It simply follows the strategy of "First come First serve with special services provided to none."
FCFS代表先來先服務調度算法 ,是一種非搶先調度算法,這意味著,如果某個進程一旦開始在處理器中執行,則無法在進程之間搶占該進程。 因此,這種算法無法實現優先級和緊急度的概念。 在FCFS算法中,進程以進入就緒狀態的順序執行。 它只是遵循“先到先得,不提供特殊服務”的策略。
Now let us try to understand this further with the help of an example. Suppose there are four processes with process ID's P1, P2, P3, and P4 and they enter into the CPU as follows:
現在,讓我們嘗試借助示例進一步了解這一點。 假設有四個進程ID為P1 , P2 , P3和P4 ,它們按如下方式進入CPU:
Process ID | Arrival Time (milliseconds) | Burst Time (milliseconds) |
---|---|---|
P1 | 0 | 5 |
P2 | 2 | 3 |
P3 | 6 | 2 |
P4 | 7 | 3 |
進程ID | 到達時間 (毫秒) | 爆發時間 (毫秒) |
---|---|---|
P1 | 0 | 5 |
P2 | 2 | 3 |
P3 | 6 | 2 |
P4 | 7 | 3 |
So, if the OS follows the FCFS algorithm for scheduling these processes, then they will be executed in the following manner:
因此,如果操作系統遵循FCFS算法來調度這些進程,則將以以下方式執行它們:
Gant Chart:
甘特圖:
Total Turn around Time = 5 + 6 + 4 + 6
= 21 milliseconds
Average Turn Around Time= Total Turn Around Time / Total No. of Processes
= 21 / 4
= 5.25 milliseconds
Total Waiting Time = 0 + 3 + 2 + 3
= 8 milliseconds
Average Waiting Time = Total Waiting Time / Total No. of Processes
= 8 / 4
= 2 milliseconds
翻譯自: https://www.includehelp.com/operating-systems/fcfs-first-come-first-serve-scheduling-algorithm.aspx
fcfs調度算法