Some Problems with the Realtime Features of Modula-2
George Mohay, K. John Gough, W. Pease · 1991
The unit of pseudo-parallelism in Modula-2 is the coroutine; coroutines switch control to one another through use of coroutine transfer operations. Standard Modula-2 supports three different coroutine transfer operations -- TRANSFER, IOTRANSFER and tile asynchronous transfer --- and provides a module priority mechanism to ensure, inter alia, that interrupts occurring during execution of all i/o (interrupt handier) coroutine are only recognised if they are of higher priority than the interrupt already being serviced. A modified set of Modula-2 coroutine transfer operations, prototyped using tile 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 frictions Priority and Previous, respectively. The former allows a real-time coroutine to interrogate tile priority of all interrupted coroutine, while tile letter is invoked by a real-time coroutine in order to determine the identify of that interrupted coroutine. This paper discusses the rationale for the extended model, illustrates its use and describes its implementation in one of tile most popular Modula-2 systems in use today, the Logitech Version 3 compiler for tire IBM PC.