Hi All,
I am comparing the performance of the Dining philosopher's problem
implemented in Java, Ada, C/Pthread, and the experimental language I
have been working on.
The algorithm is very simple: let a butler to restrict entry to the
eating table, so that deadlock is prevented.
The comparison result really surprised me, and raised a big
question mark : why java runs so fast?
The programs were constructed with basic API's and functions. I tried
to stay away from pre-defined synchronization features such as
Semaphores , atomic variables, etc.
I let each philosopher to eat 10000 times ->
Java :3.6 second, C/pthread : 7.0 seconds, Ada :8.3 seconds..
I measured the execution time by a simple ./time command on Linux. It
is coarse-grained measurement, but probably adequate to make
comparisons.
I would expect the java program to be the slowest one. However, java
is the winner. If I let each philosopher to eat 20000 rounds, Java
would have bigger advantage over C and Ada.
Does anyone here have some notions about the Java thread
implementations that can explain the cause? or Does anyone know where
I can possibly find the answer?
thanks a lot.
cheers,
Tony


|