Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread performance using countDownLatch vs join() and countDownLatch vs wait() / notify()  RSS feed

 
chryssa neoh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.. I am new in threads so I am curious on the performance on using three different methods.



In this code, the condition is that all the threads in group A must be completed then group B is allowed to proceed and so on.

Currently I am using countDownLatch, I was wondering what is the difference compared to join() in terms of performance?

Or is it better for me to replace countDownLatch with synchronization along with wait() and notify() to enhance the performance?

Thank you

 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest you write the code in the most natural way and profile later but ignoring that ;-)
join infers thread death which infers no thread pooling which is generally a good idea.

I'm not sure there is a lot in wait vs notify but there are a few blogs on the internet so ...

countdown latch vs notify
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!