threads for C/C++ under Unix?

Peter da Silva peter at ficc.uu.net
Sat Oct 14 11:50:26 AEST 1989


In article <MONTNARO.89Oct12124156 at sprite.crd.ge.com> <montanaro at crdgw1.ge.com> (Skip Montanaro) writes:
> You can't have preemptive lightweight processes without kernel support.

Well, this is a bit of a pleonasm, but all the "kernel support" you need is
alarm(1) and signal(SIGALRM, switch). The quantum is a bit long, but it'll
work. You'll have to rewrite stdio to recover from interrupted system calls,
of course, as well as putting semaphores around the likes of malloc().

The question is whether pre-emptive threads are desirable. Non-preemptive
threads are a lot easier to deal with.
-- 
Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation.
Biz: peter at ficc.uu.net, +1 713 274 5180. Fun: peter at sugar.hackercorp.com. `-_-'
                                                                           'U`
Quote: Structured Programming is a discipline -- not a straitjacket.



More information about the Comp.lang.c mailing list