最早期限安排

发布于 2024-12-07 19:32:54 字数 506 浏览 1 评论 0原文

我想用C实现最早的截止时间调度,但我在网上找不到该算法。

我理解下面的例子,当时间为0时,A1和B1都到达。由于A1的截止日期最早,所以先安排。当A1完成时,B1被交给处理器。当时间为20时,A2到达。由于 A2 的截止时间早于 B1,因此 B1 被中断,以便 A2 可以执行完成。然后在时间30时恢复B1。在时间40时到达A3。然而,B1 有一个更早的结束期限,并且允许在时间为 45 时执行完成。然后 A3 被给予处理器并在时间为 55 时完成。但是我无法想出解决方案。请帮我找到一个解决方案算法。 谢谢..

示例图像

example http://imageshack.us/photo/my-images/840/scheduling .png/

I want to implement Earliest deadline scheduling in C but I cant find the algorithm on the net..

I understand the example below that when time is 0, both A1 and B1 arrive. Since A1 has the earliest deadline, it is scheduled first. When A1 completes, B1 is given the processor.when time is 20, A2 arrives. Because A2 has an earlier deadline than B1, B1 is interrupted so that A2 can execute to completion. Then B1 is resumed when time is 30. when time is 40, A3 arrives. However, B1 has an earlier ending deadline and is allowed to execute to completion when time is 45. A3 is then given the processor and finishes when time is 55.. However I cant come up with a solution.. Please help me to find an algorithm.
Thanks..

Image of the example

example
http://imageshack.us/photo/my-images/840/scheduling.png/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

旧人哭 2024-12-14 19:32:54
  • 当进程结束时(以及开始时),将 processTimeToDeadline - processTimeToExecute 最低的进程作为新的当前进程
  • 当新进程到达时,替换当前进程当且仅当 newProcessTimeToDeadline - newProcessTimeToExecute < currentProcessTimeToDeadline - currentProcessTimeStillNeededToExecute

注意:如果您使用多个 CPU 执行此操作,则会遇到多处理器调度问题,这是 NP 完全问题。

  • when a process finishes (and at the beginning), take the process with the lowest processTimeToDeadline - processTimeToExecute as the new current process
  • When a new process arrives, replace the current process if and only if newProcessTimeToDeadline - newProcessTimeToExecute < currentProcessTimeToDeadline - currentProcessTimeStillNeededToExecute.

Note: if you do this with multiple CPU, you got the Multiprocessor scheduling problem, which is NP complete.

放低过去 2024-12-14 19:32:54

之前的答案描述了“最早可行的截止日期优先”(EFDF)调度程序,它完美地从问题中成像。
“最早截止日期优先”(EDF) 调度程序更加简单。调度程序只运行最早截止日期的任务。这就是全部。

Previous answer describe "Earliest Feasible Deadline First" (EFDF) scheduler and it fist perfectly to image from qestion.
"Earliest Deadline First" (EDF) scheduler is more simple. Scheduler just run task with earliest deadline. And it is all.

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