I was trying to build a parallelized depth first search in Java. I was trying to figure out the best way to handle the threads.
I read on http://developer.amd.com/Pages/1121200683.aspx
that it was faster to have threads alive, rather than shutting them down when we'r done with them.
So, basically... I was wondering if it was possible to create an array of threads, start them from a parent thread when needed, allowing the parent thread to go to sleep, and then let the child threads go to sleep after they are done exploring the edges and wake up the parent thread when the child threads were done.
The main questions I wasn't sure about was:
1) how do we get the number of active threads?
2) how do we allow the threads to share a common variable?
Could anyone help me out?