This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ThreadPool delay between task submittal and execution  RSS feed

 
Ryan Atwood
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks,
 
Ryan Atwood
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ignore this thread for now, i measured something wrong!

thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!