File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

Slower When threaded.

 
john sayeau
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
I also posted this in the beginner section as I am one.
I have two simple programs that do the same thing. One threaded one not. I'm doing something wrong in the threaded one as it takes , on average , 4 times longer to do the same ting as the unthreaded version. I'm running two threads on a macbook pro. The activiy monitor show both cores going really hard(95%). Can someone point me in the right direction?
Here is the threaded version.
Main:

NumberGenerator:


here is the unthreaded version:


 
Paul Clapham
Sheriff
Pie
Posts: 20166
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
It looks like you cross-posted this over here: http://www.coderanch.com/t/513688/java/java/Threading.

Please CarefullyChooseOneForum for your posts. I will lock this one.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic