So I implemented a generic thread pool by myself (might not be the most efficient way), where I have n Threads working on m tasks (basically, these are classes that implements Runnable). When a worker thread is asked to run task m1, it basically calls m1.run(). What I've noticed is that from the time I call the m1.run() function to the time it hits the m1.run(), I do see delays in the milliseconds range. I've timed almost every other aspect of my program and noticed that this call is the one that takes the longest (everything else is within a millisecond). Is it because of the way I have implemented the Thread Pool? Would switching to Sun's new Executor/Task classes make it any faster?
Joined: Feb 03, 2009
ignore this thread for now, i measured something wrong!