|Comparison of Java Threads and SugarCubes
The comparison is described in a paper which is to be read first (more complete version of it: Java threads and SugarCubes, Frédéric Boussinot, Jean-Ferdy Susini, Software Practice & Experience, vol 30(5), 545-566, 2000).
The code is available in tar.gz format. Here is a description of the directory which contains it:
- File Icobj.java contains the code for the icon.
- File IcobjApplet.java defines the applet update method.
- File FPS.java contains the instrumented code for printing the number of frames per second (FPS) on the console. Bigger the printed number is, faster the execution is.
AdHocSolutionWithThreads contains a very simple but ad hoc thread based solution. To run it, compile SinCos.java with:
then run the applet with, for example:
NOTE: CLASSPATH must contain the current directory and the directory Code. For example, on Unix:
The simple path also works:
SinCosDB.java uses double-buffering, to see the icon trajectory more precisely.SinCosDisconnect.java defines two icons, each one executed asynchronously by distinct threads.
SugarCubesSolution contains the SugarCubes solution. The applet to run is in SinCosReact.html.
- In SinCosReact2.java is the code for two icons, and in SinCosReact3.java the code for three icobjs.
- In SinCosReactInv.java is the code which change the trajectory of the second icobj at instant #1000.
GeneralSolutionWithThreads contains the generic thread-based solution using a synchronizer object in Synchro.java. The basic code is in SyncThreads.java and the corresponding applet is in SyncThreads.html.
For Unix, two utilitaries: cleanAll to remove all .class files and makeAll to compile all the classes.
inria is the directory that contains the SugarCubes (version 1).
In case of problems, please feel free to contact: