My multithreading concepts are weak and trying to learn.
In Java what I know is, we can\'t call a thread more than once:
Thread t = new Thread; //So
So, considering above 3 steps, With Threadpool step 1 and Step 3 can be eliminated after fixed number of Thread Creation. only Step 2 for each task will be executed that is why Threadpool is faster? can we say like this? am I correct?
Yes you are correct. Thread creation and destruction is one of the costly task. As in a thread pool threads are already created so the overhead of thread creation is not there. But if you have much more higher threads than it should have, it will be pretty bad for your application. It may go OutofMemorry or may be into some other issues. So to fix a thread pool size use the below formula:
no of threads = 2 * no_of_cores * no_of_disks * percentage CPU utilization you need * (1 + (W/ C))
(W/C) is the fraction stating Wait time to Compute time.