Vijay Varanasi
unread,Jul 22, 2009, 12:28:35 AM7/22/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Deuce-STM
Hi Guy,
Deuce is indeed simple to use, and I wish you all the best with your
Ph.D!
A couple of points:
1. I wrote a simple test program (see below) and noticed that multiple
runs of it are not consistent w.r.t performance: some of the runs
finish soon, while others take a long time. In fact, it looks like
some of the runs are stuck forever, and I have to kill them.
2. But here's the fun fact : you can make it run faster by connecting
to it in debug mode! I do not know why (did not dig up in the source),
but here's how to reproduce the issue. Run the code using -Xdebug.
(Assuming you hit the performance problem mentioned in point 1
above,) you will notice that it prints out "Changing from 0 to 1" (or
a few more stpes) and gets stuck, taking up ~ 80% CPU. Now if you run
jdb to connect to the process, voila!, it's done in 1 second, and jdb
fails to connect
java -Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5555 -
javaagent:c:/Temp/install/deuce_java_stm/deuceAgent-1.0.0.jar
HelloWorld
sun.misc.Launcher$AppClassLoader@92e78c interface
org.deuce.objectweb.asm.ClassVisitor
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transaction.global.ClassTransformer
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.ByteCodeVisitor
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.Agent
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.objectweb.asm.ClassAdapter
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.ClassTransformer
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.util.IgnoreTree
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.FramesCodeVisitor$VersionException
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.util.IgnoreTree$TreeNode
Changed from 0 to 1
Changed from 1 to 2
Changed from 2 to 3
<stuck>
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5555
Set uncaught java.lang.Throwable
================ simple test =================
package deucetest;
import java.util.ArrayList;
import java.util.List;
import org.deuce.Atomic;
/**
* {@link #incrementX()} is made atomic using org.deuce.Atomic, which
effectively
* serializes the incrementing in order from 0 to 100.
*
* @author varanav
*
*/
public class HelloWorld {
static Integer x = new Integer(0);
/**
* @param args
*/
public static void main(String[] args) {
List<Thread> l = new ArrayList<Thread>();
for (int i = 0; i < 100; i++) {
Thread t = new Thread() {
public void run() {
incrementX();
}
};
t.start();
l.add(t);
}
try {
for (Thread t: l) t.join();
} catch (InterruptedException e) {
System.err.println("thread interrupted during join()");
}
System.out.println(x);
} // main
@Atomic
public static void incrementX() {
int xInt = x.intValue();
// try { Thread.sleep( Math.abs((new Random()).nextInt() %
5)); } catch (InterruptedException e) {}
x = Integer.valueOf(xInt + 1);
System.out.println("Changed from " + xInt + " to " + x.intValue
());
}
}