This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Dual processor utilization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

Dual processor utilization

Sudhanshu Umalkar
Greenhorn

Joined: Nov 19, 2002
Posts: 12
Is there a way to improve performance of the java module by utilizing the second processor on a dual processor machine?
To be precise, can I execute two threads and specify exclusively to each one of them which processor (CPU) they should utilize?
How a dual processor machine can be used efficiently to improve the performance of a java application?
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
What operating system are you using? Most modern operating systems (Unix, Linux, WinNT/2000 etc.) will automatically assign your threads to run on whatever processor is free at any given time. If you have a 2-threaded application, it will automatically take advantage of the 2 CPUs. There is no need to specify which processor the thread will run on.
In fact, the operating system performs "time slicing" which implies your thread may be executing on either processor, and may in fact switch between processors!
Geoffrey


Sun Certified Programmer for the Java 2 Platform
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Please don't cross-post. I'm closing this copy of this thread. Followups here.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dual processor utilization
 
Similar Threads
netbeans 6.5.1 + glassfish 2 poor performance
JVM / JIT compiler
Batch Processing with Java
Utilizing second processor
basic question...