[PDP8-Lovers] Re: if you hadn't already known this about the PDP-8

From: Douglas W. Jones <jones_at_cs.uiowa.edu>
Date: Thu Dec 13 14:10:00 2001

Mark Crispin <MRC_at_CAC.Washington.EDU> wrote:
> Stacks are very useful, but they are not the solution to everything.

Absolutely agreed.

> One of the biggest deficiencies of C is its lack of co-routines, since
> it only has the stack style of subroutine calling. Yeah, I know about
> setjmp/longjmp, but those are one-way, not true co-routines.

Well, setjmp and longjmp are pretty powerful. see

  http://www.cs.uiowa.edu/~jones/opsys/threads/

for a machine-independent user-level thread package implemented in C using
setjmp and longjmp for control transfers between threads. It comes very
close to what a real coroutine afficianado would like. (Writing the
thread launch code in a machine independent way was murder.)

Curiously, the same thing can be done without longjmp()! I had a student
write me a thread package in Pascal once. All he needed was a mechanism
to convert pointers to integers and back again (easy enough in standard
Pascal, so long as it doesn't check variant records). Given this, his
code did essentially the same thing as my thread package.

> Of course, talking about co-routines to youngsters is likely to get
> their eyes to glaze over, since they won't have a clue as to what I'm
> talking about.

Indeed.
                                Doug Jones
                                jones_at_cs.uiowa.edu
Received on Thu Dec 13 2001 - 14:10:00 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:38 BST