|This article does not cite any references or sources. (December 2006)|
Time-driven programming is a computer programming paradigm, where the control flow of the computer program is driven by a clock and is often used in Real-time computing. A program is divided into a set of tasks (i.e., processes or threads), which has a periodic activation pattern. The activation pattern for all tasks is stored in a dispatch table, were the Least-Common-Multiple (LCM) of all period-times determines the length of the dispatch table. The scheduler of the program dispatches all tasks according to the dispatch table, on which end a new instance of the dispatch table is initiated.[clarification needed (What does this mean?)]
The programming paradigm is mostly used for safety critical programs, since the behaviour of the program is highly deterministic. No external events are allowed to affect the control-flow of the program, the same pattern (i.e., described by the dispatch table) will be repeated time after time. However, idle time of the processor is also highly deterministic, allowing for the scheduling of other non-critical tasks through slack stealing techniques during these idle periods.
The drawback with the method is that the program becomes static (in the sense that small changes may recompile into large effects on execution structure), and unsuitable for applications requiring a large amount of flexibility. For example, the execution time of a task may change if its program code is altered. As a consequence, a new dispatch table must be regenerated for the entire task set. Such a change may require expensive retesting as is often required in safety critical systems.