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调度算法