• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ThreadPool delay between task submittal and execution

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ignore this thread for now, i measured something wrong!

thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic