非抢占式实时操作系统
Here you will learn about difference between preemptive and non-preemptive scheduling in os.
在这里,您将了解os中抢占式和非抢占式调度之间的区别。
Preemptive Scheduling
抢占式调度
Preemptive Scheduling means once a process started its execution, the currently running process can be paused for a short period of time to handle some other process of higher priority, it means we can preempt the control of CPU from one process to another if required.
抢占式调度是指一旦某个进程开始执行,就可以将当前正在运行的进程暂停一小段时间,以处理其他更高优先级的进程,这意味着如果需要,我们可以将对一个进程的CPU控制权抢占到另一个进程。
A computer system implementing this supports multi-tasking as it gives the user impression that the user can work on multiple processes.
实现此目的的计算机系统支持多任务,因为它给用户留下了用户可以在多个进程上工作的印象。
It is practical because if some process of higher priority is encountered then the current process can be paused to handle that process.
这是实用的,因为如果遇到某些优先级更高的进程,则可以暂停当前进程以处理该进程。
Examples:- SRTF, Priority, Round Robin, etc.
示例: -SRTF,优先级,循环查询等。
Non-Preemptive Scheduling
非抢占式调度
Non-Preemptive Scheduling means once a process starts its execution or the CPU is processing a specific process it cannot be halted or in other words we cannot preempt (take control) the CPU to some other process.
非抢占式调度是指一旦某个进程开始执行或CPU正在处理特定进程,就无法停止调度,换句话说,我们无法将CPU抢占(控制)其他进程。
A computer system implementing this cannot support the execution of process in a multi task fashion. It executes all the processes in a sequential manner.
实现此目的的计算机系统不能支持以多任务方式执行过程。 它以顺序方式执行所有过程。
It is not practical as all processes are not of same priority and are not always known to the system in advance.
这是不切实际的,因为所有过程都不具有相同的优先级,并且系统并不总是事先知道的。
Examples:- FCFS, SJF, Priority, etc.
操作系统中抢占式和非抢占式的区别 (Difference between Preemptive and Non-Preemptive Scheduling in OS)
Preemptive Scheduling | Non-Preemptive Scheduling |
Processor can be preempted to execute a different process in the middle of execution of any current process. | Once Processor starts to execute a process it must finish it before executing the other. It cannot be paused in middle. |
CPU utilization is more compared to Non-Preemptive Scheduling. | CPU utilization is less compared to Preemptive Scheduling. |
Waiting time and Response time is less. | Waiting time and Response time is more. |
The preemptive scheduling is prioritized. The highest priority process should always be the process that is currently utilized. | When a process enters the state of running, the state of that process is not deleted from the scheduler until it finishes its service time. |
If a high priority process frequently arrives in the ready queue, low priority process may starve. | If a process with long burst time is running CPU, then another process with less CPU burst time may starve. |
Preemptive scheduling is flexible. | Non-preemptive scheduling is rigid. |
Ex:- SRTF, Priority, Round Robin, etc. | Ex:- FCFS, SJF, Priority, etc. |
抢占式调度 | 非抢占式调度 |
在任何当前进程的执行过程中,处理器都可以抢先执行不同的进程。 | 一旦处理器开始执行一个进程,它必须先完成它,然后再执行另一个进程。 它不能在中间暂停。 |
与非抢先式调度相比,CPU利用率更高。 | 与抢先式调度相比,CPU利用率更低。 |
等待时间和响应时间更少。 | 等待时间和响应时间更长。 |
优先调度是优先的。 最高优先级的进程应始终是当前使用的进程。 | 当某个进程进入运行状态时,直到完成服务时间,该进程的状态才会从调度程序中删除。 |
如果高优先级进程频繁到达就绪队列,则低优先级进程可能会饿死。 | 如果突发时间较长的进程正在运行CPU,则另一个CPU突发时间较短的进程可能会饿死。 |
抢占式调度非常灵活。 | 非抢占式调度是严格的。 |
例如:-SRTF,优先级,循环查询等。 | 例如:-FCFS,SJF,优先级等 |
This article is submitted by Rahul Maheshwari. You can connect with him on facebook.
本文由Rahul Maheshwari提交。 您可以在Facebook上与他建立联系。
Comment below if you have any queries related to above tutorial for difference between preemptive and non-preemptive scheduling in os.
如果您对os中的抢占式和非抢占式调度之间的区别有任何疑问,请在下面评论。
翻译自: https://www.thecrazyprogrammer.com/2017/03/difference-preemptive-non-preemptive-scheduling-os.html
非抢占式实时操作系统