Posted By:
Bob_Looney
Posted On:
Friday, January 18, 2002 08:55 AM
I'm looking for a way to find out when all of my threads have finished processing. I have several different implementations that work on a single processor machine such as... inst is an array of 1000+ threads for (i = 0;i inst[i].start() for (i = 0;i inst[i].join(); however this never terminates on a multiprocessor machine. I've also tried an isAlive loop instead of join that waits until all threads have terminated until it goes on. Again, this works on the single processor but not the multi-processor machine. The functionality I'm aiming for is to kickoff a thread after receiving data on a socket that does a bunc
More>>
I'm looking for a way to find out when all of my threads have finished processing. I have several different implementations that work on a single processor machine such as...
inst is an array of 1000+ threads
for (i = 0;i
inst[i].start()
for (i = 0;i
inst[i].join();
however this never terminates on a multiprocessor machine. I've also tried an
isAlive
loop instead of
join
that waits until all threads have terminated until it goes on. Again, this works on the single processor but not the multi-processor machine.
The functionality I'm aiming for is to kickoff a thread after receiving data on a socket that does a bunch of math processing in parallel so that no request takes overly long to return which it would in a serial implementation, instead all are slightly slower (yes, i realized i just explained parallelism, sorry). I need to time the worst case of 1000(+) requests (threads) needing to execute at the same time. I do a System.currentTimeMillis (); before the processing starts and I need to do another one after the processing ends. however, the multi-processor machines seem to never finish one or more threads. There are no deadlocks occuring. I've thought of creating an array of objects that each call
wait
and then
notify
from each thread when I'm done. This seems like a ton of overhead though, but if it's the only way then it's the only way.
Additionally if anyone knows of a resource that explains how the sun JVM for solaris and Win32 function on multiple processors for calls like Thread.isAlive, Thread.join, etc. I'd appreciate it.
<<Less