Hi, On Wed, 15 Nov 2006, TH & CD Maher wrote: > Are threads only used in OO programming? > > Reagrds, > > > Chris Maher. > With threads, if you can set out your code so that one set of variables is associated with each thread, life as a programmer becomes simpler. This suits the OO model well - one object, one thread.
That said, you can still do threads quite easily in a language such as C. The tricky bit, as always, is to get a clean partition between the variables accessed by which thread. Where there is no clean partition, one ends up with a profusion of locks (and they breed like rabbits at times) which leads to the inevitable deadlock. Fork is indeed a nice tool - it is a way of letting the OS to enforce the partition between the variables accessed by different threads. There are many times when fork() is appropriate. But not always is fork the best thing. As always, programmers should be ready and willing to use the best tool for the job. Derek. -- Derek Smithies Ph.D. IndraNet Technologies Ltd. Email: [EMAIL PROTECTED] ph +64 3 365 6485 Web: http://www.indranet-technologies.com/
