最早期限安排
我想用C实现最早的截止时间调度,但我在网上找不到该算法。
我理解下面的例子,当时间为0时,A1和B1都到达。由于A1的截止日期最早,所以先安排。当A1完成时,B1被交给处理器。当时间为20时,A2到达。由于 A2 的截止时间早于 B1,因此 B1 被中断,以便 A2 可以执行完成。然后在时间30时恢复B1。在时间40时到达A3。然而,B1 有一个更早的结束期限,并且允许在时间为 45 时执行完成。然后 A3 被给予处理器并在时间为 55 时完成。但是我无法想出解决方案。请帮我找到一个解决方案算法。 谢谢..
示例图像
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
newProcessTimeToDeadline - newProcessTimeToExecute < currentProcessTimeToDeadline - currentProcessTimeStillNeededToExecute
。注意:如果您使用多个 CPU 执行此操作,则会遇到多处理器调度问题,这是 NP 完全问题。
processTimeToDeadline - processTimeToExecute
as the new current processnewProcessTimeToDeadline - newProcessTimeToExecute < currentProcessTimeToDeadline - currentProcessTimeStillNeededToExecute
.Note: if you do this with multiple CPU, you got the Multiprocessor scheduling problem, which is NP complete.
之前的答案描述了“最早可行的截止日期优先”(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.