优先级抢占调度

发布于 2025-01-05 00:44:25 字数 333 浏览 0 评论 0原文

使用优先级抢占式调度时,较高优先级是否会让位于优先级较低但突发时间较短的进程?

例如,如果我:

    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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南街女流氓 2025-01-12 00:44:25

优先级调度始终选择当前准备运行的具有最高优先级的进程。如果有多个进程具有当前最高优先级,则需要另一种调度算法在这些进程中进行选择。 非抢占式优先级调度仅在正在运行的进程完成其工作或(自愿)让步给调度程序时才选择要运行的新进程。

抢占优先级调度是相同的算法,但是如果一个比当前正在运行的进程优先级更高的新进程到达,它会立即被选择。新进程不必等到当前正在运行的进程完成或让出。

在您的示例中,抢先优先级调度的甘特图(3 为最高优先级,1 为最低优先级)如下所示:

|    P1   |  P3 |        P2      |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

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:

|    P1   |  P3 |        P2      |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
动次打次papapa 2025-01-12 00:44:25
| p1 | p2 | p3 | p1 |

0....2....8....11...14   

以1为最高优先级。

| p1 | p2 | p3 | p1 |

0....2....8....11...14   

taking 1 as the highest priority.

迟月 2025-01-12 00:44:25
       |p1  |p2  |p3  |p1  |

       0    2    8    11   14 

因为如果新到达的进程的优先级高于当前正在运行的进程的优先级,抢占式方法就会抢占。

       |p1  |p2  |p3  |p1  |

       0    2    8    11   14 

because preemptive approach will preempt if the priority of the newly-arrived process is higher than the priority of currently running process..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文