Download Embedded Multitasking with small - innovated
Transcript
256 Chapter 4 a sequence. Again, using the previous example, the design would look like the following: Algorithm 4.20 Task Initial Skip timer value Display Task 5 Alarm Control Task (3 states) 101 (102, 103) Time Base Task 2004 Reload value 5 100 2000 The sequence of tasks would be the display task on pass 2000, the Alarm control task on pass 2001 through 2003, the Time Base task on pass 2004 and, finally, the Display task once again on 2005. The other condition that can cause problems with a passive priority handler is the occasional execution of other tasks, which do not have skip timer values that fall on even multiples of the largest integer factor. The execution of these other tasks will therefore routinely coincide with the execution of some or all of the states in the tasks that use the priority handler. While juggling the offset values solved our previous problem, this problem is going to require a little more design effort. To solve this problem, we will have to do a timing study on all of the tasks in the system, building up a table of execution times for each state of each task. We can then identify those combinations of states and tasks that will take longer to execute than the available execution time in the system tick. We can then take the states in the tasks that cause a problem and break them into two or more states, reducing their execution time. The result is a collection of states in the handler-control tasks and coinciding states in the nonhandler-controlled tasks which can have coincident execution, without overrunning the system tick. For example, consider the previous example, combined with the execution of the Command task, which has a skip timer reload value of 34. 34 does not share the common integer factor of 5 with the other skip timer values in the Display, Alarm Control, and Time Base tasks. As a result, we can expect the Command task to execute coincident with all three of the priority handler controlled tasks during the course of the system’s execution. Looking at a hypothetical list of states and execution