fcfs调度
In the FCFS scheduling, we consider that all the processes or jobs are the CPU bound jobs (if any process spends most of its time simply using the CPU or doing calculations, so this process is called CPU bound process) only. We do not think about the context switching time.
在FCFS调度中 ,我们认为所有进程或作业都是受CPU约束的作业(如果任何进程花费大部分时间只是使用CPU或进行计算,因此该进程称为受CPU约束的进程)。 我们不考虑上下文切换时间 。
A procedure in which a processor (central processing unit) follows to change from one task (or job) to another while ensuring that the tasks do not conflict by the context or state of a process so that it can be reloaded when required and execution can be resumed from the same point as earlier, this is called Context Switching.
一种过程,在该过程中,处理器(中央处理单元)从一个任务(或作业)更改为另一个任务,同时确保任务不会因进程的上下文或状态而冲突,以便可以在需要时重新加载它,并可以执行从先前的相同点恢复,这称为上下文切换 。
The average waiting time of the system will be increased If we consider the time taken by the scheduler in context switching. This condition also affects the efficiency of the system. It is always overhead in scheduling.
如果我们考虑调度程序在上下文切换中花费的时间,则系统的平均等待时间将增加。 这种情况也会影响系统的效率。 调度总是开销。
If we consider the context switching time in the system, so the efficiency will be affected. We can describe it with the following example.
如果我们考虑系统中的上下文切换时间 ,那么效率将受到影响。 我们可以通过以下示例对其进行描述。
Here, we are considering six processes with process id as P1, P2, P3, P4, P5, and P6. The arrival time and Burst time of these processes are as under,
在这里,我们考虑六个进程ID为P1 , P2 , P3 , P4 , P5和P6的进程。 这些过程的到达时间和爆发时间如下,
Process Id | Arrival time | Burst time |
---|---|---|
P0 | 0 | 2 |
P1 | 1 | 3 |
P2 | 2 | 2 |
P3 | 3 | 5 |
P4 | 4 | 6 |
P5 | 5 | 4 |
流程编号 | 到达时间 | 爆发时间 |
---|---|---|
P0 | 0 | 2 |
P1 | 1个 | 3 |
P2 | 2 | 2 |
P3 | 3 | 5 |
P4 | 4 | 6 |
P5 | 5 | 4 |
We denote the context switching time by δ sign and let's take δ=1 unit; Then the Gantt chart of the system will be prepared as follows:
我们用δ符号表示上下文切换时间,取δ= 1单位 ; 然后,将按以下方式准备系统的甘特图:
Gantt Chart
甘特图
By this overhead, the system will take an extra 1 unit of time after the execution of every process or task to schedule the next task.
通过这种开销,系统将在执行每个进程或任务之后花费额外的1个时间单位来安排下一个任务。
Useless time / Wasted time = 6 * δ = 6 * 1 = 6 unit
Total time taken by all processes = 28 unit
Useful time of processes = 28 unit – 6 unit = 22 unit
Efficiency (η) of system = Useful time / Total time
= 22 unit / 28 unit
= 0.7857
= 78.57 %
Inefficiency = Wasted time / Total time
= (6 / 28 * 100) %
= 21.42 %
References:
参考文献:
翻译自: https://www.includehelp.com/operating-systems/fcfs-scheduling-with-overhead.aspx
fcfs调度