This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Slower When threaded. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

Slower When threaded.

john sayeau
Ranch Hand

Joined: Aug 23, 2010
Posts: 33
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Slower When threaded.
 
Similar Threads
Threading question
Performance wrt multi threaded approach with Thread Pool vs Sequential execution
File
Countdown timer in java
Thread3