sjf调度算法
In SJF Scheduling, CPU is assigned to the process having the smallest burst time but it can not be implemented practically, because we don't know burst time of the arrived processes in advance.
在SJF Scheduling中 ,将CPU分配给具有最短突发时间的进程,但是由于我们事先不知道到达进程的突发时间,因此它实际上无法实现。
The predicted burst time of the future process may not always be correct because the burst time of a process also depends on the kind of a process.
未来过程的预测突发时间可能并不总是正确的,因为一个过程的突发时间还取决于一个过程的类型。
There are many methods by which we can predict the burst time for the processes,
我们可以通过多种方法来预测过程的爆发时间 ,
Static methods
静态方法
Dynamic methods
动态方法
![predict the burst time 1](https://www.includehelp.com/operating-systems/images/predict-the-burst-time-1.jpg)
1)静态方法 (1) Static methods)
There are two static factors by we can predict the burst time of processes,
我们可以通过两个静态因素来预测进程的爆发时间,
According to process type
根据Craft.io类型
According to process size
根据Craft.io尺寸
![predict the burst time 2](https://www.includehelp.com/operating-systems/images/predict-the-burst-time-2.jpg)
i)根据Craft.io类型 (i) According to process type)
In this method, burst time can be predicted according to the type of process,
在这种方法中,可以根据进程类型预测突发时间,
User Process:
用户流程 :
The Process which is initiated by the users is referred to as user processes. User processes can be of the following types.
由用户发起的过程称为用户过程。 用户进程可以是以下类型。
Foreground process:
前台流程 :
The processes which are accessed by the user to perform their needs such as MS office, Editors, utility software, calculators, etc are called foreground processes.
用户访问以执行其需求的过程,例如MS Office,编辑器,实用软件,计算器等,称为前台过程。
These types of processes are a perfect mix of CPU and IO bound processes so they have a bit higher burst time.
这些类型的进程是CPU和IO绑定进程的完美结合,因此它们的突发时间要长一些。
Interactive Process:
互动过程 :
The processes which interact with the user at different time intervals or execution of these processes totally depends on the user inputs are called Interactive Processes. Various games have come in the category of interactive processes.
在不同时间间隔与用户交互的过程或这些过程的执行完全取决于用户的输入,称为交互过程。 各种游戏都属于交互过程类别。
They don't need a processor for a large amount of time. As a result, the burst time of these processes is low. They are mainly IO bound processes because they mainly depend upon the user's interactivity with the process
他们不需要大量时间的处理器。 结果,这些过程的突发时间很短。 它们主要是受IO约束的流程,因为它们主要取决于用户与流程的交互性
Background process:
后台进程 :
Some processes support the execution of other processes are known as background processes. These processes work in hidden mode. Just like, the key logger is the process that records the keys pressed by the user and activities of the user on the system. These processes need CPU for a large amount of time that’s why they are CPU bound processes.
一些支持其他进程执行的进程称为后台进程。 这些进程以隐藏模式工作。 就像键记录器一样,它是记录用户按下的键和用户在系统上的活动的过程。 这些进程需要大量的CPU时间,这就是它们是受CPU约束的进程的原因。
Operating System Process:
操作系统流程 :
Operating System Processes can be of different types such as schedulers, compilers, program managers and many more other system processes. Burst time of Operating system process is generally lower approximate 3 to 5 units of time.
操作系统进程可以是不同类型的,例如调度程序,编译器,程序管理器以及更多其他系统进程。 操作系统进程的突发时间通常较低,大约为3到5个单位时间。
ii)根据Craft.io规模 (ii) According to process size)
In this method, burst time can be predicted according to the size of a process.
在这种方法中,可以根据过程的大小预测突发时间。
Here, the burst time is taken similar to the currently running process and the newly arrived process that is to be executed.
在此,突发时间类似于当前正在运行的进程以及将要执行的新到达进程。
For example, suppose a size currently running process (Pold) is 150 KB and it takes 10 units of time for its execution.
例如,假设当前正在运行的进程(Pold)大小为150 KB,并且执行该进程需要10个时间单位。
So, the burst time for any newly arrived process of size around 150 KB can be taken as 10 units of time.
因此,任何大小约为150 KB的新到达进程的突发时间都可以视为10个时间单位。
References:
参考文献:
sjf调度算法