-
Bug
-
Resolution: Fixed
-
P2
-
5.0, 6
-
b90
-
x86
-
windows_2000, windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Single Dual-Core Pentium 4.
Dell Dimension DIM4700
The dual-core seems to matter.
A DESCRIPTION OF THE PROBLEM :
Running two threads, one of which creates a lot of garbage, results in almost no CPU allocated to either thread. I cannot find evidence that the machine is in any way busy, in particular, the disk is not working.
Running a single thread that creates a lot of garbage gives the same behavior when -Xincgc is specified.
This may be related to dual-core technology. I have not tried this on enough machines to know for sure.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code and look at the Windows Task Manager. CPU is near zero.
Alternatively, don't start Thread t but instead use -Xincgc. Same phenomenon.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected 100% CPU utilization. Got near-zero.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
class Test1 {
public static void main(String[] args) {
Thread t = new Thread(new Run());
t.start();
Thread t2 = new Thread(new Junk());
t2.start();
}
private static class Junk implements Runnable {
public void run() {
while ( true ) {
new Integer(1);
}
}
}
private static class Run implements Runnable {
public void run() {
long t1 = System.currentTimeMillis();
for (int j=0; j < 10000; j++) {
for (int k=0; k < 1000000; k++) {
}
}
long t2 = System.currentTimeMillis();
System.out.println("Done: " + (t2-t1));
}
}
}
---------- END SOURCE ----------
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Single Dual-Core Pentium 4.
Dell Dimension DIM4700
The dual-core seems to matter.
A DESCRIPTION OF THE PROBLEM :
Running two threads, one of which creates a lot of garbage, results in almost no CPU allocated to either thread. I cannot find evidence that the machine is in any way busy, in particular, the disk is not working.
Running a single thread that creates a lot of garbage gives the same behavior when -Xincgc is specified.
This may be related to dual-core technology. I have not tried this on enough machines to know for sure.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code and look at the Windows Task Manager. CPU is near zero.
Alternatively, don't start Thread t but instead use -Xincgc. Same phenomenon.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected 100% CPU utilization. Got near-zero.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
class Test1 {
public static void main(String[] args) {
Thread t = new Thread(new Run());
t.start();
Thread t2 = new Thread(new Junk());
t2.start();
}
private static class Junk implements Runnable {
public void run() {
while ( true ) {
new Integer(1);
}
}
}
private static class Run implements Runnable {
public void run() {
long t1 = System.currentTimeMillis();
for (int j=0; j < 10000; j++) {
for (int k=0; k < 1000000; k++) {
}
}
long t2 = System.currentTimeMillis();
System.out.println("Done: " + (t2-t1));
}
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-6307983 JDK-1.6.0 -Xprof is unusably slow
- Closed