操作系统可以使用各种调度算法来调度实时任务。这些调度算法根据调度点的确定进行分类。
1. 时钟驱动调度:
调度点由从时钟接收的中断决定的调度,称为时钟驱动调度。时钟驱动调度处理接下来要处理的任务取决于时钟中断点。
2. 事件驱动调度:
调度点由不包括时钟中断的事件发生确定的调度,称为事件驱动调度。事件驱动调度处理接下来要处理的任务与时钟中断点无关。
时钟驱动和事件驱动调度的区别:
CLOCK-DRIVEN SCHEDULING | EVENT-DRIVEN SCHEDULING |
---|---|
Tasks are scheduled on the basis of interrupts received by clock. | Tasks are scheduled on the basis of event occurrences excluding clock interrupts. |
Scheduling points are determined by clock interrupts. | Scheduling points are determined by task completion and task arrival events. |
Clock-driven scheduling algorithms are simple. | Event-driven scheduling algorithms are very complex. |
Clock-driven scheduling is not flexible as event-driven. | Event-driven scheduling is more flexible than clock-driven. |
It can only handle periodic tasks. | It can schedule periodic, sporadic and aperiodic tasks. |
It is called offline scheduling. | It is called online scheduling. |
It is widely used in embedded systems. | It is less suitable for embedded systems. |
It is efficient than event-driven. | It is sophisticated but more proficient. |
It is used in small applications. | It is used in larger applications. |