Hi,
Can some people run the attached (and shockingly simple) code 1000 times on some multiprocessor machines using free VM's other than SableVM, where the VM will get control of two or more processors, and report if there are any exceptions or segfaults?
I use:
$ for num in `seq 1 1000`; do sablevm ThreadStarter; done
I currently get:
java.lang.NullPointerException at IncrementRunnable.run (ThreadStarter.java:51) at ThreadStarter.main (ThreadStarter.java:38) at java.lang.VirtualMachine.invokeMain (VirtualMachine.java) at java.lang.VirtualMachine.main (VirtualMachine.java:108)
or
Exception in thread "Thread-1" java.lang.NullPointerException at IncrementRunnable.run (ThreadStarter.java:51) at java.lang.Thread.run (Thread.java:705) at java.lang.VMThread.callRun (VMThread.java:119) at java.lang.Thread.callRun (Thread.java:391) at java.lang.VirtualMachine.runThread (VirtualMachine.java:137)
along with a couple of assertion failures in the VM, and it's non-deterministic (hence 1000 runs). We did manage to fix a locking bug like this (Archie, maybe you want to see bug 92 at sablevm.org). I find that using a slower execution mode (specifically the switch interpreter with debugging features enabled) in SableVM gives more errors (more room for threads to interleave or something, I guess).
I'm still not convinced that it's an SMP problem per se, and the exceptions above make it seem partially like a Classpath issue. If it fails for you also, insights as to what's going on are appreciated.
Thanks a lot, Chris
public class ThreadStarter {
public ThreadStarter() {
}
public static void main(String[] argv) {
Runnable myRunnable;
Thread myThread;
/* way 1 */
myRunnable = new IncrementRunnable();
myThread = new Thread(myRunnable);
myThread.start();
/* way 2 */
myRunnable = new IncrementRunnable();
myRunnable.run();
}
}
class IncrementRunnable implements Runnable {
private int k = 0;
public IncrementRunnable() {
}
public void run() {
for(int i=0;i<100;i++) {
k++;
}
}
}
_______________________________________________ Classpath mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath

