Skip to main content

Advertisement

Log in

Using genetic algorithms for early schedulability analysis and stress testing in real-time systems

  • Published:
Genetic Programming and Evolvable Machines Aims and scope Submit manuscript

Abstract

Reactive real-time systems have to react to external events within time constraints: Triggered tasks must execute within deadlines. It is therefore important for the designers of such systems to analyze the schedulability of tasks during the design process, as well as to test the system's response time to events in an effective manner once it is implemented. This article explores the use of genetic algorithms to provide automated support for both tasks. Our main objective is then to automate, based on the system task architecture, the derivation of test cases that maximize the chances of critical deadline misses within the system; we refer to this testing activity as stress testing. A second objective is to enable an early but realistic analysis of tasks' schedulability at design time. We have developed a specific solution based on genetic algorithms and implemented it in a tool. Case studies were run and results show that the tool (1) is effective at identifying test cases that will likely stress the system to such an extent that some tasks may miss deadlines, (2) can identify situations that were deemed to be schedulable based on standard schedulability analysis but that, nevertheless, exhibit deadline misses.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3

Similar content being viewed by others

Notes

  1. Note that task periods also have to be estimated.

  2. This target task can be the most ‘critical’ task in the system, for instance (e.g., a missed deadline for the target task would have catastrophic results). This analysis can be repeated for all ‘critical’ tasks, leading to several test scenarios, each focusing on stress testing a specific task.

  3. A longer T leads to longer execution times.

  4. The Rate Monotonic Algorithm is extended to deal with priority inversion through the Generalized Completion Time Theorem.

  5. Note that this mathematical formulation of the problem assumes tasks are ordered in decreasing order of priority (for the purpose of schedulability analysis), i.e., task numbered 1 has the highest priority, task numbered 2 has the second highest priority, …, task numbered n has the lowest priority.

  6. Note that since we are looking for a minimum, in a set of sums, that is below or equal to 1, we can stop our investigation of elements (k, l) in R i as soon as we find a pair for which the sum is indeed below or equal to 1: if this is the minimum we can stop, if not this ensures that the minimum (necessarily below the value we find below or equal to 1) is indeed below or equal to 1. For tasks t2 and t3, we can thus stop at (k,l) = (1,2) and (k,l) = (2,1), respectively.

References

  1. B. Beizer, Software Testing Techniques, 2nd edition, Van Nostrand Reinhold, 1990.

  2. R. V. Binder, Testing Object-Oriented Systems—Models, Patterns, and Tools, Object Technology, Addison-Wesley, 1999.

  3. L. C. Briand, Y. Labiche, and M. Shousha, “Stress testing for real-time systems using genetic algorithms,” Carleton University, Technical Report SCE-03-23, http://www.sce.carleton.ca/Squall/, September 2003.

  4. A. E. Eiben, P. E. Raue, and Z. Ruttkay, “Solving constraint satisfaction problems using genetic algorithms,” in Proc. IEEE World Conference on Evolutionary Computing, 1994, pp. 542–547.

  5. H. Gomaa, Designing Concurrent, Distributed, and Real-Time Applications with UML, Object Technology, Addison Wesley, 2000.

  6. M. G. Harbour, M. H. Klein, R. Obenza, B. Pollak, and T. Ralya, A Practitioner's Handbook for Real-Time Analysis: Guide to Rate-Monotonic Analysis for Real-Time Systems, Kluwer, 1993.

  7. R. L. Haupt and S. E. Haupt, Practical Genetic Algorithms, Wiley-Interscience, 1998.

  8. M. A. Iverson, F. Ozguner, and L. C. Potter, “Statistical prediction of task execution times through analytic benchmarking for scheduling in a heterogeneous environment,” IEEE Transactions on Computers, vol. 48, no. 12, pp. 1374–1379, 1999.

    Article  Google Scholar 

  9. J. W. S. Liu, Real-Time Systems, Prentice Hall, 2000.

  10. C. D. Locke, D. R. Vogel, and T. J. Mesler, “Building a predictable avionics platform in ada: A case study,” in Proc. IEEE Real Time Systems Symposium, 1991, pp. 181–189.

  11. S. W. Mahfoud and D. E. Goldberg, “Parallel recombinative simulated annealing: A genetic Algorithm,” Parallel Computing, vol. 21, no. 1, pp. 1–28, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  12. Z. Michalewicz, Genetic Algorithms + Data Structures = Evolution Programs, Springer, 1996.

  13. F. Mueller and J. Wegener, “A Comparison of Static Analysis and Evolutionary Testing for the Verification of Timing Constraints,” in Proc. IEEE Real Time Technology and Applications Symposium, 1998, pp. 179–188.

  14. M. A. Pawlowsky, “Crossover Operators,” in Practical Handbook of Genetic Algorithms Applications, L. Chambers (ed.), CRC Press, 1995, vol. 1, pp. 101–114.

  15. J. D. Schaffer, R. A. Caruna, L. J. Eshelman, and R. Das, “A study of control parameters affecting online performance of genetic algorithms for function optimization,” in Proc. International Conference on Genetic Algorithms and Their Applications, 1989, pp. 51–60.

  16. L. Sha and J. B. Goodenough, “Real-time scheduling theory and ada,” Software Engineering Institute, Technical Report CMU/SEI-89-TR-014, 1989.

  17. J. E. Smith and T. C. Fogarty, “Adaptively parameterized evolutionary systems: Self adaptive recombination and mutation in a genetic algorithm,” in Parallel Problem Solving From Nature,Voigt, Ebeling, Rechenberg, and Schwefel, (eds.), 1996, vol. 4, pp. 441–450.

  18. B. Sprunt, Aperiodic Task Scheduling for Real-Time Systems, Ph.D. Thesis, Carnegie Mellon, Department of Electrical and Computer Engineering, 1990.

  19. B. Sprunt, L. Sha, and J. Lehoczky, “Aperiodic task scheduling for hard real-time systems,” Real-Time Systems, vol. 11, pp. 27–60, 1989.

  20. N. Tracey, J. A. Clark, K. C. Mander, and J. A. McDermid, “An automated framework for structural test-data generation,” Proc. IEEE Conference on Automated Software Engineering, 1989, pp. 285–288.

  21. M. Wall, “GAlib: A C++ Library of Genetic Algorithm Components,” Massachusetts Institute of Technology, http://lancet.mit.edu/ga/dist/galibdoc.pdf, August, 1996.

  22. J. Zhang and S. C. Cheung, “Automated test case generation for the stress testing of multimedia systems,” Software—Practice and Experience, vol. 32 15, pp. 1411–1435, 2002.

  23. B. J. Jain, H. Pohlheim, and J. Wegener, “On termination criteria of evolutionary algorithms,” in Proc. Genetic and Evolutionary Computation Conference, 2001, p. 768.

Download references

Acknowledgments

This work was partly supported by a Canada Research Chair (CRC) grant. Lionel Briand and Yvan Labiche were further supported by NSERC operational grants. This work is part of a larger project on testing object-oriented systems with the UML (www.sce.carleton.ca/Squall).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lionel C. Briand.

Appendices

Appendix A: Schedulability analysis for Example 2

The Generalized Completion Time Theorem (GCTT) determines whether periodic tasks are schedulable, i.e., whether tasks can meet their deadlines, given preemption by higher priority tasks and blocking time by lower priority tasks. First note that this applies only to periodic tasks. However, for schedulability analysis, aperiodic tasks are considered equivalent to periodic tasks whose periods are equal to the minimum inter-arrival times [5]. The theorem assumes all tasks are ready for execution at the start of the task's period: i.e., at time zero, all tasks are awaiting execution [16]. It is important to note that the GCTT can only determine whether a group of tasks is schedulable. It cannot show whether they are not schedulable. (Hence, if the GCTT check fails, the group of tasks at hand may still be schedulable.) Additionally, it is argued [16] that “when all the tasks are initiated at the same time (the worst-case phasing), if a task completes its execution before the end of its first period, it will never miss a deadline.”

As discussed before, GCTT can be graphically illustrated by a timing diagram [5]. We rather focus here on its mathematical formulation.

A set of n periodic tasks can be scheduled by the Rate Monotonic AlgorithmFootnote 4 for all tasks phasing if the following condition is satisfied:

$$ \forall i,1 \le i \le n,\mathop {\min }\limits_{(k,l) \in R_i } \left( {\sum\limits_{j = 1}^{i - 1} {\frac{{C_j }}{{lT_k }}\left\lceil {\frac{{lT_k }}{{T_j }}} \right\rceil } + \frac{{C_j }}{{lT_k }} + \frac{{B_i }}{{lT_k }}} \right) \le 1 $$

where

$$ \,R_i = \left\{ {(k,l)\,|\,1 \le k \le i,l = 1, \ldots ,\left\lfloor {\frac{{T_i }}{{T_k }}} \right\rfloor } \right\}. $$

(C i and T j are the execution time and period of task i. B i is the worst-case blocking time for task i)Footnote 5

The theorem checks if each task can complete its execution before its first deadline, by checking the amount of time spent waiting for higher priority tasks (preemption) and lower dependent priority tasks (blocking). In the formula, i denotes the task to be checked and k denotes each of the tasks that affects the completion time of task i, i.e., task i and the higher priority tasks. For a given i and k, each value of l represents the number of times task k can execute during task i's period, which corresponds to the amount of time during which task i is preempted. Note that when determining B i , each task on which i depends can block i only once because of priority differences.

Let us apply this theorem to the example in Section 4.2. The task architecture is recalled here to ease reading: Task t1 is periodic (C 1 = 1, T 1 = 3); Task t2 is aperiodic but transformed into a periodic task for schedulability analysis purposes (C 2 = 3, T 2 = 9); Task t3 is periodic (C 3 = 2, T 3 = 9); t1 and t3 are inter-dependent; t1 has the highest priority, t2 has the second highest priority and t3 has the lowest priority.

Let us apply the theorem on each of the three tasks in sequence.

1.1 Task t1

$$ R_1 = \left\{ {(k,l)|1 < k < 1,l = 1, \ldots ,\left\lfloor {\frac{{T_1 }}{{T_k }}} \right\rfloor } \right\} = \{ (1,1)\} . $$

Then,

$$\displaylines{\mathop {\min }\limits_{(k,1) \in R_1 } \Bigg(\sum\limits_{j = 1}^0 {\frac{{C_j }}{{lT_k }}\left\lceil {\frac{{lT_k }}{{T_j }}} \right\rceil } + \frac{{C_1 }}{{lT_k }} + \frac{{B_1 }}{{lT_k }}\Bigg)\cr = \mathop {\min }\limits_{(1,1)} \bigg(\frac{{C_1 }}{{lT_k }} + \frac{{B_1 }}{{lT_k }}\bigg) = \frac{{C_1 }}{{T_1 }} + \frac{{B_1 }}{{T_1 }} = \frac{1}{3} + \frac{2}{3} = \frac{3}{3} < 1. } $$

Indeed, t1 can only be blocked by lower priority task t3 once during a period of 2 time units: B 1 = 2. This means that t1 meets its first deadline.

1.2 Task t2

$$R_2 = \left\{ {(k,l)|1 \le k \le 2,l = 1, \ldots ,\left\lfloor {\frac{{T_2 }}{{T_k }}} \right\rfloor } \right\}.$$

For \( k = 1,2, {\rm that\,\, is} , l= 1,2,3.\,\, {\rm For}\,\, k = 2, l=1, \ldots, \lfloor {\frac{{T_2 }}{{T_2 }}} \rfloor \) that is, l = 1. Thus R 2 = {(1, 1), (1, 2), (1, 3), (2, 1)}. Note that since t2 is not dependent on the other two tasks, especially t3 (lowest priority task), t2 cannot be blocked by t3 and then B2 = 0.

$$\displaylines{ {\rm For}\,(k,l) = (1,1),\,\sum\limits_{j = 1}^1 {\frac{{C_j }}{{T_1 }}} \left\lceil {\frac{{T_1 }}{{T_j }}} \right\rceil + \frac{{C_2 }}{{T_1 }} + \frac{{B_2 }}{{T_1 }} = \frac{{C_1 }}{{T_1 }}\left\lceil {\frac{{T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{T_1 }}\cr = \frac{{C_1 }}{{T_1 }} + \frac{{C_2 }}{{T_1 }} = \frac{1}{3} + \frac{3}{3} > 1. }$$
$$\displaylines{ {\rm For}\,(k,l) = (1,2),\sum\limits_{j = 1}^1 {\frac{{C_j }}{{2T_1 }}} \left\lceil {\frac{{2T_1 }}{{T_j }}} \right\rceil + \frac{{C_2 }}{{2T_1 }} + \frac{{B_2 }}{{2T_1 }} = \frac{{C_1 }}{{2T_1 }}\left\lceil {\frac{{2T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{2T_1 }}\cr = \frac{{2C_1 }}{{2T_1 }} + \frac{{C_2 }}{{2T_1 }} = \frac{2}{6} + \frac{3}{6} < 1. } $$
$$\displaylines{{\rm For}\,(k,l) = (1,3),\sum\limits_{j = 1}^1 {\frac{{C_j }}{{3T_1 }}} \left\lceil {\frac{{3T_1 }}{{T_j }}} \right\rceil + \frac{{C_2 }}{{3T_1 }} + \frac{{B_2 }}{{3T_1 }} = \frac{{C_1 }}{{3T_1 }}\left\lceil {\frac{{3T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{3T_1 }}\cr = \frac{{3C_1 }}{{3T_1 }} + \frac{{C_2 }}{{3T_1 }} = \frac{3}{9} + \frac{3}{9} < 1. }$$
$$\displaylines{{\rm For}\,(k,l) = (2,1),\sum\limits_{j = 1}^1 {\frac{{C_J }}{{T_2 }}} \left\lceil {\frac{{T_2 }}{{T_j }}} \right\rceil + \frac{{C_2 }}{{T_2 }} + \frac{{B_2 }}{{T_2 }} = \frac{{C_1 }}{{T_2 }}\left\lceil {\frac{{T_2 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{T_2 }}\cr = \frac{{3C_1 }}{{T_2 }} + \frac{{C_2 }}{{T_2 }} = \frac{3}{8} + \frac{3}{8} \le 1.} $$

This means that t2 meets its first deadline.Footnote 6

1.3 Task t3

$$R_3 = \left\{ {(k,l)|1 \le k \le 3,l = 1, \ldots ,\left\lfloor {\frac{{T_3 }}{{T_k }}} \right\rfloor } \right\}.$$

For k = 1, \(l = 1, \ldots ,\lfloor {\frac{{T_3 }}{{T_1 }}} \rfloor ,\) that is, l = 1, 2, 3. For k = 2, \(l = 1, \ldots ,\lfloor {\frac{{T_3 }}{{T_2 }}} \rfloor ,\) that is, l = 1. For k = 3, \(l = 1, \ldots ,\lfloor {\frac{{T_3 }}{{T_3 }}} \rfloor ,\) that is l = 1. Since there is no lower priority task than t3, B 3 = 0.

$$\displaylines{ {\rm For}\,(k,l) = (1,1),\sum\limits_{j = 1}^2 {\frac{{C_j }}{{T_1 }}} \left\lceil {\frac{{T_1 }}{{T_j }}} \right\rceil + \frac{{C_3 }}{{T_1 }} + \frac{{B_3 }}{{T_1 }} = \frac{{C_1 }}{{T_1 }}\left\lceil {\frac{{T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{T_1 }}\left\lceil {\frac{{T_1 }}{{T_2 }}} \right\rceil\cr \qquad + \frac{{C_3 }}{{T_1 }} + \frac{{B_3 }}{{T_1 }} = \frac{{C_1 }}{{T_1 }} + \frac{{C_2 }}{{T_1 }} + \frac{{C_3 }}{{T_1 }} + \frac{{B_3 }}{{T_1 }} = \frac{6}{3} > 1. } $$
$$\displaylines{ {\rm For}\,(k,l) = (1,2),\sum\limits_{j = 1}^2 {\frac{{C_j }}{{2T_1 }}} \left\lceil {\frac{{2T_1 }}{{T_j }}} \right\rceil + \frac{{C_3 }}{{2T_1 }} + \frac{{B_3 }}{{2T_1 }}\cr = \frac{{C_1 }}{{2T_1 }}\left\lceil {\frac{{2T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{2T_1 }}\left\lceil {\frac{{2T_1 }}{{T_2 }}} \right\rceil + \frac{{C_3 }}{{2T_1 }} + \frac{{B_3 }}{{2T_1 }}\cr = \frac{{2C_1 }}{{2T_1 }} + \frac{{C_2 }}{{2T_1 }} + \frac{{C_3 }}{{2T_1 }} + \frac{{B_3 }}{{2T_1 }} = \frac{7}{6} > 1. }$$
$$\displaylines{ {\rm For}\,(k,l) = (1,3),\sum\limits_{j = 1}^2 {\frac{{C_j }}{{3T_1 }}} \left\lceil {\frac{{3T_1 }}{{T_j }}} \right\rceil + \frac{{C_3 }}{{3T_1 }} + \frac{{B_3 }}{{3T_1 }}\cr = \frac{{C_1 }}{{3T_1 }}\left\lceil {\frac{{3T_1 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{3T_1 }}\left\lceil {\frac{{3T_1 }}{{T_2 }}} \right\rceil + \frac{{C_3 }}{{3T_1 }} + \frac{{B_3 }}{{3T_1 }} \cr = \frac{{3C_1 }}{{3T_1 }} + \frac{{2C_2 }}{{3T_1 }} + \frac{{C_3 }}{{3T_1 }} + \frac{{B_3 }}{{3T_1 }} = \frac{{11}}{9} > 1. }$$
$$\displaylines{{\rm For}\,(k,l) = (2,1),\sum\limits_{j = 1}^2 {\frac{{C_J }}{{T_2 }}} \left\lceil {\frac{{T_2 }}{{T_j }}} \right\rceil + \frac{{C_3 }}{{T_2 }} + \frac{{B_3 }}{{T_2 }} = \frac{{C_1 }}{{T_2 }}\left\lceil {\frac{{T_2 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{T_2 }}\left\lceil {\frac{{T_2 }}{{T_2 }}} \right\rceil + \frac{{C_3 }}{{T_2 }} + \frac{{B_3 }}{{T_2 }}\cr = \frac{{3C_1 }}{{T_2 }} + \frac{{C_2 }}{{T_2 }} + \frac{{C_3 }}{{T_2 }} + \frac{{B_3 }}{{T_2 }} = \frac{8}{9} < 1. }$$
$$\displaylines{{\rm For}\,(k,l) = (3,1),\sum\limits_{j = 1}^2 {\frac{{C_j }}{{T_3 }}} \left\lceil {\frac{{T_3 }}{{T_j }}} \right\rceil + \frac{{C_3 }}{{T_3 }} + \frac{{B_3 }}{{T_3 }} = \frac{{C_1 }}{{T_3 }}\left\lceil {\frac{{T_3 }}{{T_1 }}} \right\rceil + \frac{{C_2 }}{{T_3 }}\left\lceil {\frac{{T_3 }}{{T_2 }}} \right\rceil + \frac{{C_3 }}{{T_3 }} + \frac{{B_3 }}{{T_3 }}\cr = \frac{{3C_1 }}{{T_3 }} + \frac{{2C_2 }}{{T_3 }} + \frac{{C_3 }}{{T_3 }} + \frac{{B_3 }}{{T_3 }} = \frac{{11}}{9} > 1. }$$

This means that t3 meets its first deadline.6

1.4 Conclusion

As a conclusion, all three tasks meet their first deadlines, which demonstrates their schedulability.

Table 6. Executing RTTT once for each task in the avionics application (complete results)
Table 7 Executing RTTT 10 times for each task in the avionics application (complete results)
Table 7 Continued

Appendix B:Additional results for the industrial case study

Tables 6 and 7 below show the complete results of executing RTTT for each task of the Avionics case study. Results in Table 6 are partially presented in Table 4 whereas results in Table 7 are partially presented in Table 5.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Briand, L.C., Labiche, Y. & Shousha, M. Using genetic algorithms for early schedulability analysis and stress testing in real-time systems. Genet Program Evolvable Mach 7, 145–170 (2006). https://doi.org/10.1007/s10710-006-9003-9

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10710-006-9003-9

Keywords

Navigation