Solved

Set the number of processors java uses

Posted on 2004-03-24
6
695 Views
Last Modified: 2008-03-06
I just upgraded my machine to a 3Ghz pentium 4 with hyper-threading.  It shows up to the os as 2 logical processors.  When I run any java program, it doesn't seem to take advantage of this - my cpu consumption never exceeds 50%.

Is there some way I can tell java how many processors I have?

Thanks,

Shawn
0
Comment
Question by:ShawnCurry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10674082
not that i am aware of
0
 
LVL 92

Assisted Solution

by:objects
objects earned 125 total points
ID: 10674087
see if anything in here helps:
http://java.sun.com/docs/performance/
0
 
LVL 9

Assisted Solution

by:mmuruganandam
mmuruganandam earned 125 total points
ID: 10674508
It is purely OS dependent.  The JVM is being loaded and handled by the OS.  The thread scheduling within the JVM would happen based on how the JVM process between CPU's


Regards,
Muruga
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
solnpro earned 250 total points
ID: 10679909
There is a really good article called Hyper-Threading Java in the August 2003 Java Developer's Journal or online at http://www.sys-con.com/story/?storyid=37663 if you are a subscriber.  It also includes benchmarking source code.

Some of the questions this article would have me raise are:

Are you running on a supported OS?  See http://www.intel.com/support/platform/ht/os.htm?iid=ipp_htm+os&

Was your application single or multi-threaded?  (Single-threaded applications will see little improvement.)

If you were multi-threading, were your threads performing different operations?  (Multi-threaded applications with threads performing the same tasks on one physical CPU will see little improvement.)

<Solnpro>
0
 
LVL 3

Author Comment

by:ShawnCurry
ID: 10696771
The application satisfies all the above.  I am running xp pro.  My app has a total of 3 thread pools, currently two run 4 worker threads, and the other runs two threads; also I have several random threads running tasks in the gui (though I plan to consolidate these).

The first 2 pools (for a total of 8 threads) deal only with communicating with a cgi script (waiting for the server response).  The other pool (two threads) process the responses.

I've figured out why it was chewing up so much processor on my 3ghz.. which leads (indirectly) to my next question..

I'll leave this open for a few more days; since it doesn't seem to be something I can set in java; maybe someone has another idea??

Thanks,
Shawn
0
 
LVL 92

Expert Comment

by:objects
ID: 10702588
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Running JavaFX on JDeveloper 12C 1 76
Java basic valueOf question 1 33
Java program running SQL query 5 48
swing controls 2 21
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question