File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Utilizing second processor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Utilizing second processor" Watch "Utilizing second processor" New topic

Utilizing second processor

Sudhanshu Umalkar

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?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

There's no way to specify the "CPU affinity" of a thread; but if you create multiple threads on a multiprocessor machine, then a well-implemented JVM will schedule them efficiently on the available processors. I've had dual-CPU Xeons for years now, and find that under both Linux and Windows, multi-threaded CPU-bound programs see an appropriate speedup on multiprocessor machines.

[Jess in Action][AskingGoodQuestions]
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Improve java's performance to the detriment of which other program? This kind of thing is handled automatically by the operating system. If two CPUs are available and you have a program that can run concurrently, then the OS will likely make use of both CPUs. But you will not have exclusive or dedicated access.
I agree. Here's the link:
subject: Utilizing second processor
It's not a secret anymore!