优先级抢占调度
使用优先级抢占式调度时,较高优先级是否会让位于优先级较低但突发时间较短的进程?
例如,如果我:
Arrival Time Burst Time Priority
P1 0 5 3
P2 2 6 1
P3 3 3 2
甘特图看起来像这样吗?
| P1 | P2 | P3 | P1 |
0 2 8 11 16
When using Priority Preemptive Scheduling, does a higher priority yield way to a process with a lower priority but with a shorter burst time?
For example, if I had:
Arrival Time Burst Time Priority
P1 0 5 3
P2 2 6 1
P3 3 3 2
Would the Gannt chart look like this?
| P1 | P2 | P3 | P1 |
0 2 8 11 16
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
优先级调度始终选择当前准备运行的具有最高优先级的进程。如果有多个进程具有当前最高优先级,则需要另一种调度算法在这些进程中进行选择。 非抢占式优先级调度仅在正在运行的进程完成其工作或(自愿)让步给调度程序时才选择要运行的新进程。
抢占优先级调度是相同的算法,但是如果一个比当前正在运行的进程优先级更高的新进程到达,它会立即被选择。新进程不必等到当前正在运行的进程完成或让出。
在您的示例中,抢先优先级调度的甘特图(3 为最高优先级,1 为最低优先级)如下所示:
Priority Scheduling always selects the process(es) with the highest priority currently ready to run. If there is more than one process having the currently highest priority, you need a second scheduling algorithm to choose among these processes. Non-preemptive Priority Scheduling only selects a new process to run if the running process finished its work or yields (voluntarily) to the scheduler.
Preemptive Priority Scheduling is the same algorithm but if a new process having a higher priority than the currently running process arrives, it gets selected immediately. The new process has not to wait until the currently running process finishes or yields.
In your sample, the Gantt chart for Preemptive Priority Scheduling and 3 being the highest and 1 the lowest priority would look like:
以1为最高优先级。
taking 1 as the highest priority.
因为如果新到达的进程的优先级高于当前正在运行的进程的优先级,抢占式方法就会抢占。
because preemptive approach will preempt if the priority of the newly-arrived process is higher than the priority of currently running process..