Solved

Set the number of processors java uses

Posted on 2004-03-24
6
696 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

751 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