Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / July 2006

Tip: Looking for answers? Try searching our database.

JVM fails to use more than one CPU/core on RH Linux?

Thread view: 
Spuuf Cool - 24 Jul 2006 20:44 GMT
We're using the Sun 1.5.0_06 JVM on RedHat (AS). The box has 4 CPUs,
they're all available and get some load (i. e. OS recognized them and
they work). But al our JVM max out by just "digesting" a single CPU, i.
e. any JVM maxes out at 25% of the system load.

Using a simple CPU-eater program that runs multiple thread I was able
to:
- "digest" 2 cores on Win XP
- "digest" 2 cores on Max OS X (Intel)
- still only 1 (!) CU on the Linux server

Where's the problem? Anyone else having the same issue? There is just
one particularity to the Lunix installation, the Xeon CPUs are 64bit
but we're using the 32bit version of the OS (and JV; and all other
stuff).

Anyone seein the same problem.

For testing purposes this is the code I used (will digest up to 3 CPU
cores for max 30 secs.):

package test;

public class CpuBound {

    public static void main(String[] args) throws InterruptedException {
        Thread th1 = new Thread(new Eater());
        Thread th2 = new Thread(new Eater());
        Thread th3 = new Thread(new Eater());
        th1.start();
        th2.start();
        th3.start();
        int joinTime = 10*1000;
        System.out.println("Joining " + th1);
        th1.join(joinTime);
        System.out.println("Joining " + th2);
        th2.join(joinTime);
        System.out.println("Joining " + th3);
        th3.join(joinTime);
        System.out.println("End");
        System.exit(-1);
    }

    static class Eater implements Runnable {

        public void run() {
            Thread.yield();
            for( long l = Long.MIN_VALUE; l < Long.MAX_VALUE; l++) {
                long sprloink = l*l;
                if(sprloink > l) {
                    sprloink = l;
                } else {
                    sprloink-=l;
                }
            }
        }   
    }
}
Chris Uppal - 25 Jul 2006 09:26 GMT
> We're using the Sun 1.5.0_06 JVM on RedHat (AS). The box has 4 CPUs,
> they're all available and get some load (i. e. OS recognized them and
> they work). But al our JVM max out by just "digesting" a single CPU, i.
> e. any JVM maxes out at 25% of the system load.

Presumably the JVM hasn't "realised" that it's running on a multi-CPU system.
What does

   Runtime.getRuntime().availableProcessors()

return ?

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.