I would like to execute the following algorithm - this should be done in Java
for(int i = 0; i< 100; i++){ create 8 threads which perform a task wait for all threads to finish }
It is advisable that threads are not continuously created and destroyed due to overhead (and the fact that each thread will have <20 milliseconds of operation), which triggered the idea of ββthread pools 1 . I also know that using Executable 2 , you can call shutdown and then wait for Termination. However, in this case, this is undesirable due to the cycle. So how is thread synchronization going?
I would like to synchronize the threads in the thread pool, as would be done using the traditional join join () method.
source share