Reasoning about Timeouts
In real-time programming a timeout mechanism allows exceptional behaviour, such as a lack of response, to be handled effectively, while not overly affecting the programming for the normal case. For example, in a pump controller if the water level has gone below the minimum level and the pump is on and hence pumping in more water, then the water level should rise above the minimum level within a specified time. If not, there is a fault in the system and it should be shut down and an alarm raised. Such a situation can be handled by normal case code that determines when the level has risen above the minimum, plus a timeout case handling the situation when the specified time to reach the minimum has passed.
In this paper we introduce a timeout mechanism, give it a formal definition in terms of more basic real-time commands, develop a refinement law for introducing a timeout clause to implement a specification, and give an example of using the law to introduce a timeout. The framework used is a machine-independent real-time programming language, which makes use of a deadline command to represent timing constraints in a machine-independent fashion. This allows a more abstract approach to handling timeouts.
KeywordsNormal Case Auxiliary Variable Sequential Composition Idle Period Nondeterministic Choice
Unable to display preview. Download preview PDF.
- S. Dunne. Abstract commands: A uniform notation for specification and implementation. In C.J. Fidge, editor, Computing: The Australian Theory Symposium (CATS 2001), volume 42 of Electronic Notes in Theoretical Computer Science, pages 104–123. Elsevier, 2001.Google Scholar
- C.J. Fidge, I.J. Hayes, and G. Watson. The deadline command. IEE Proceedings-Software, 146(2):104–111, April 1999.Google Scholar
- S. Grundon, I.J. Hayes, and C.J. Fidge. Timing constraint analysis. In C. McDonald, editor, Computer Science’98: Proc. 21st Australasian Computer Sci. Conf. (ACSC’98), Perth, 4-6 Feb., pages 575–586. Springer, 1998.Google Scholar
- I.J. Hayes. Separating timing and calculation in real-time refinement. In J. Grundy, M. Schwenke, and T. Vickers, editors, Int. Refinement Workshop and Formal Methods Pacific 1998, pages 1–16. Springer, 1998.Google Scholar
- I.J. Hayes. A predicative semantics for real-time refinement. In A. McIver and C.C. Morgan, editors, Essays in Programming Methodology. Springer, 2002.Google Scholar
- I.J. Hayes. Reasoning about real-time repetitions: Terminating and nonterminating. Science of Computer Programming, 43(2–3):161–192, April 2002.Google Scholar
- I.J. Hayes and M. Utting. Coercing real-time refinement: A transmitter. In D.J. Duke and A.S. Evans, editors, BCS-FACS Northern Formal Methods Workshop (NFMW’96). Springer, 1997.Google Scholar
- E.C.R. Hehner. Termination is timing. In J.L.A. van de Snepscheut, editor, Mathematics of Program Construction, volume 375 of Lecture Notes in Computer Science, pages 36–47. Springer, June 1989.Google Scholar
- E.C.R. Hehner. A Practical Theory of Programming. Springer, 1993.Google Scholar
- C.A.R. Hoare and He Jifeng. Unifying Theories of Programming. Prentice Hall, 1998.Google Scholar
- C.B. Jones. Program specification and verification in VDM. Technical Report UMCS-86-10-5, Department of Computer Science, University of Manchester, 1986.Google Scholar
- C.C. Morgan. Programming from Specifications. Prentice Hall, second edition, 1994.Google Scholar
- C.C. Morgan and T.N. Vickers. Types and invariants in the refinement calculus. In C.C. Morgan and T.N. Vickers, editors, On the Refinement Calculus, pages 127–154. Springer-Verlag, 1994. Originally published as .Google Scholar
- S. Schneider. Specification and verification in timed CSP. In M. Joseph, editor, Real-time Systems: Specification, Verification and Analysis, chapter 6, pages 147–181. Prentice Hall, 1996.Google Scholar
- S. Schneider. Concurrent and Real-time Systems: The CSP Approach. Wiley, 2000.Google Scholar
- D.J. Scholefield. A Refinement Calculus for Real-Time Systems. PhD thesis, Department of Computer Science, University of York, U.K., 1992.Google Scholar