Gough, K. John and Mohay, George M. and Pease, Wayne (1991) Real-time programming in Modula-2. Australian Computer Journal, 23 (4). pp. 175-182.
|HTML Citation||EndNote||Dublin Core||Reference Manager|
Full text not available from this archive.
The unit of pseudo-parallelism in Modula-2 is the coroutine; coroutines switch control to one another through the use of simple coroutine TRANSFER operations. In the case of programs which need to cater for realtime events (i.e. interupts) an I/O coroutine awaiting an interrupt suspends itself pending the occurrence of the specified interrupt using the IOTRANSFER operation. Recognition of the awaited interupt, when it occurs, then causes execution of an asynchronous coroutine transfer which despatches the awaiting I/O coroutine. The module priority mechanism ensures inter alia, that other interrupts occurring during execution of that I/O or device handler coroutine will only be recognised if they are of higher priority. A modified set of Modula-2 coroutine primitives, prototyped using the PDP-11 M23 Modula-2 system, has been described previously. That model included the new primitive operation Attachinterrupt which effectively replaces IOTRANSFER, leading to an arguably simpler and more elegant structure for real-time pseudo- parallel Modula-2 programs. That model has now been extended to incorporate the additional primitive functions Priority and Previous respectively. The former provides a means by which a realtime coroutine may interrogate the priority of the coroutine which it has preempted (interrupted), while the latter is invoked by a coroutine in order to establish the identity of the coroutine which it has preempted via an interrupt or which it has succeeded via a synchronous transfer operation. This paper discusses the rationale for the extended model and its implementation in one of the most popular Modula-2 systems in use today, the Logitech Version 3 compiler for the IBM PC, and illustrates its use.
Archive Staff Only: edit this record