aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes 100% CPU usage on Dual Core PC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "100% CPU usage on Dual Core PC" Watch "100% CPU usage on Dual Core PC" New topic
Author

100% CPU usage on Dual Core PC

Prabu MP
Greenhorn

Joined: Jun 12, 2006
Posts: 1
We have this new problem in our application which runs perfectly in single CPU systems.
And this situation happens occassionally in the client side(Java Swing).

Did anybody face this problem? Is there any VM argument to optimize for multi-processor systems?

Here is the summary of the problem:

Application Type : Client Server using Java Swing/RMI
Problem Environment : DualCore Intel Pentium D, 2800 MHz
Actual Problem : 100% CPU usage of one Processor(resulting 50%)

Thanking you in advance.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Welcome to the JavaRanch, Prabu.
You don't tell us what the behavior is on a single-core system. Does the program use 50% of the CPU? 100%? What kind of use do you expect? What are the relative speeds of the CPU? Do they both have similar amounts of memory and network bandwidth? I could imagine if the single-core system was blocked on network IO or some other resource, that would throttle the CPU. The code may also make assumptions on threading or timing that just happen to work on a slower CPU but break on a faster CPU.
Can you duplicate the behavior you see with a small program (not more than 100-200 lines) that would be reasonable for us to look at (remember, we're all volunteers here answering questions in our spare time)?
[ June 12, 2006: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

"Prabu MP",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Originally posted by Joe Ess:
Welcome to the JavaRanch, Prabu.
You don't tell us what the behavior is on a single-core system. Does the program use 50% of the CPU? 100%? What kind of use do you expect? What are the relative speeds of the CPU? Do they both have similar amounts of memory and network bandwidth? I could imagine if the single-core system was blocked on network IO or some other resource, that would throttle the CPU. The code may also make assumptions on threading or timing that just happen to work on a slower CPU but break on a faster CPU.
Can you duplicate the behavior you see with a small program (not more than 100-200 lines) that would be reasonable for us to look at (remember, we're all volunteers here answering questions in our spare time)?

[ June 12, 2006: Message edited by: Joe Ess ]


Joe the "problem" they seem to be describing is purely that one CPU is 100% usage and the other is 0%. Maybe I'm misreading but I don't see any problems with the application itself, no bugs or bad behavior, just that it's not using the second CPU at all. An almost identical question is posted in the advanced forum as well and I haven't the slightest idea what the answer to either is.
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Actually Henry Wong just confirmed what I thought in the other thread:

Originally posted by Henry Wong:

Most modern JVMs will distribute threads across the processors. However, you actually need active threads to run on the processors. So... if you only have one compute intensive thread in your application, don't expect more than one CPU to be at 100%.

Henry


Verify that the JVM you have actually can distribute threads across processors. If it can chances are you have one Thread doing most of the work resulting in 100% CPU usage on one processor while other threads are idle and not using any of the other processor. Multithreading an application isn't enough, if you want efficient use of multiple processors you have to write an application that distributes the workload efficiently across threads. If you have fifty threads running but one of them accounts for 90% of the load then adding more processors won't help you.
Tim Berett
Ranch Hand

Joined: Jun 14, 2002
Posts: 35
how do we ensure that the JVM can distribute threads across multiprocessors? I have a heavily threaded application too but it seems that it is not using the other processor too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 100% CPU usage on Dual Core PC
 
Similar Threads
Java Client (Swing and AWT) is hanged up on Pentium-4 Machine
Filthy Rich Clients: Couple of questions
max number of concurrent socket connections in java nio ?
How can I control a CPU usages?
My Apache-Tomcat eating 100% Cpu usage!!