Figure 3 shows a fragment of a simple program using the coroutine library.
This is akin to the Simula approach to coroutines [Birtwistle et al.
An extreme case is the availability of just one CPU: then the mechanism may be used for
coroutine programming.
The third form describes subroutine and
coroutine returns.
Since JSD targets implementations in languages that do not support concurrent tasks, the processes are instead mapped onto
coroutines managed by a tailor-made scheduler.
(1985) "The
coroutines of Hanoi, SIGPLAN Notices, Vol.
For Kahn and MacQueen's streams, data circulate among
coroutines. For Milner's and Hoare's process calculi, messages are sent and received along channels.
Many of the concepts in OOP were available in Simula 67, including class, subclass, virtual function, and active objects in the form of
coroutines. Class simulation may be viewed as the first application framework.
The set of synchronization primitives may include both simple operations, like communication between
coroutines, and much more complex mechanisms, like rendez-vous, conditional critical sections, monitors, etc.
In fact Simula, the first object-oriented language, simulated a simple form of concurrency using
coroutines on conventional architectures.
Coroutines are not suitable for specifying true parallel processing since: a.
The objects are then combined to define the overall user interface as a set of
coroutines, rather than inappropriately as a single highly regular state transition diagram.