• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

100% CPU usage on Dual Core PC

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic