[vtk-developers] suggestion for vtkMultiThreader.cxx
warfield at bwh.harvard.edu
Mon Jun 4 22:43:01 EDT 2001
vtkMultiThreader.cxx in some places uses a strategy of starting
this->NumberOfThreads-1 additional threads to run work in separate threads
and runs a pthread_join to wait for these jobs to complete.
The thread running the pthread_join is suspended until the thread it is
waiting for finishes. If there are this->NumberOfThreads CPUs available
for work then running only this->NumberOfThreads-1 jobs wastes wallclock time.
It would be better to run this->NumberOfThreads of jobs.
vtkMultiThreader.cxx lines 322-341:
// Using POSIX threads
// We want to use pthread_create to start this->NumberOfThreads-1 additional
// threads which will be used to call this->SingleMethod(). The
// parent thread will also call this routine. When it is done,
// it will wait for all the children to finish.
// First, start up the this->NumberOfThreads-1 processes. Keep track
// of their process ids for use later in the pthread_join call
Simon Warfield, Ph.D. warfield at bwh.harvard.edu Phone:617-732-7090
http://www.spl.harvard.edu/~warfield FAX: 617-582-6033
Thorn 329, Brigham and Women's Hospital, Harvard Medical School
Department of Radiology, 75 Francis St, Boston, MA, 02115
More information about the vtk-developers