[M3devel] onoing hardware clearance.

Mika Nystrom mika at async.caltech.edu
Sun Jun 5 04:48:53 CEST 2011

>Use of pthreads was a major step toward gaining portability=2C besides perf=
>ormance on multiprocessor systems (i.e. all systems).
>Short of that=2C we did switch to get/set/make/swapcontext for user threads=
>And sigaltstack on some platforms.
>OpenBSD is the only outlier I think -- pthreads=2C but for userthreads we s=
>till hack on the jmpbuf.

Too bad the pthreads implementation is broken...

But I hope we keep the user threads implementation working for other
reasons.  It's far easier to add new concurrency mechanisms, and to
control the overhead of threading, in the user threads implementation
than in the pthreads one.

I'm specifically thinking of stuff like programs with many threads (I mean
millions of threads) or things like "goroutines".  Handling either is not
particularly difficult with user threads.  Same with the stack overlapping
tricks I was investigating a while back.  Not sure if it's even possible
with pthreads.  Also consider CSP-like constructs.  CSP channels can be
emulated under pthreads (indeed one would probably do it with the plain
Modula-3 threading constructs) but become very inefficient.

Maybe M-on-N threading (or whatever it's called) would be necessary
to make all this work best.  User threads within pthreads.  Is that


More information about the M3devel mailing list