Messages in this thread | | | Date | Wed, 13 Jun 2001 14:20:26 +0200 | From | Kurt Garloff <> | Subject | Re: threading question |
| |
On Tue, Jun 12, 2001 at 01:07:11PM -0600, ognen@gene.pbi.nrc.ca wrote: > due to the nature of the problem (a pairwise mutual alignment of n > sequences results in mx. n^2 alignments which can each be done in a > separate thread), I need to create and destroy the threads frequently. > > I am not really comfortable with 1.4 - 1.5 speedups since the solution was > intended as a Linux one primarily and it just happenned that it works (and > now even better) on Solaris/SGI/OSF...
Nor would I.
What I do in my numerics code to avoid this problem, is to create all the threads (as many as there are CPUs) on program startup and have then wait (block) for a condition. As soon as there's something to to, variables for the thread are setup (protected by a mutex) and the thread gets signalled (cond_signal). If you're interested in the code, tell me.
This is supposed to be much faster than thread creation.
Regards, -- Kurt Garloff <garloff@suse.de> Eindhoven, NL GPG key: See mail header, key servers Linux kernel development SuSE GmbH, Nuernberg, FRG SCSI, Security [unhandled content-type:application/pgp-signature] | |