Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Guarded and unguarded coroutines: an implementation in BCPL
Fisher A. Software--Practice & Experience14 (4):369-376,1984.Type:Article
Date Reviewed: May 1 1985

The author starts with some critical comments on the BCPL coroutine primitives described by Moody and Richards [1]. Without discussing what he considers the desirable properties to be achieved, Fisher immediately introduces his own low-level set. The basic means of transferring control is the routine SWAPCO(), which has no arguments and resumes an unspecified different coroutine. This set he calls “unguarded coroutines.” They make no provision for the passing of values between coroutines, so some primitives for “guarded coroutines” which allow this--CALLCO and ACCEPTCO--are defined in terms of them. The specifications are curious, in that they require coroutines to unnecessarily pass their own identities as parameters; even determining these identities requires an awkward use of side-effects. The routines are implemented in terms of an inelegant sort of “busy waiting” on global variables. They are called “guarded” because they guard the coroutine from being resumed at an appropriate time, but the very choice of terminology suggests a view of coroutines as being overly concerned with transfers of control rather than of data. We are told that it is normal to follow CALLCO immediately by ACCEPTCO, which itself suggests that the primitives seen by the user are not ideally chosen. No justification for preserving both unguarded and guarded coroutine facilities is given.

Two useful primitives, PUSHCO and POPCO, provide a bracketing around sets of cynamically created coroutines and allow the subsequent deletion of whole groups of coroutines extremely easily. They are a good addition to the Moody and Richards set.

The only example program given is a poorly described treewalking program which uses another primitive, NAMECO, which is only introduced later, and then inadequately. A section on applications makes tantalizing reference to their use in solving some tricky problems in an ALGOL68 compiler, but too sketchily to be very enlightening.

The whole paper would have benefited greatly from more general considerations of what are the strengths and weaknesses of different views of coroutines, before defining yet another one. Even one of the advantages claimed here, that no stack size needs to be specified when a coroutine is created, turns out to depend entirely on the underlying operating system.

Reviewer:  Benedict Heal Review #: CR108825
1) Moody, K.; and Richards, M.A coroutine mechanism for BCPL, Softw. Pract. Exper. 10 (1980), 765–771.
Bookmark and Share
 
Coroutines (D.3.3 ... )
 
 
BCPL (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Coroutines": Date
A simplified coroutine structure for Modula-2
Mohay G. Journal of Pascal, Ada & Modula-2 6(1): 35-42, 1987. Type: Article
Jun 1 1988
Implementing a simulation tool in a high-level language with no multitasking facilities
Cavouras J. Software--Practice & Experience 13(9): 809-815, 1983. Type: Article
Oct 1 1985
Should COBOL support coroutines?
Dwyer B. Australian Computer Journal 17(2): 62-66, 1985. Type: Article
Apr 1 1987
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy