About Me

My photo
PhD Candidate at Purdue University, Computer Science.

Tuesday, September 22, 2009

Unbiasing the biased thing

I think the title is quite interesting. For VMs guys the biased locking is a well known topic.
I read a post few months ago an entry about the impact of the biased implementation in Java 6, and to get full idea go quickly through the comments as well.
I liked to make the same experiment against the JikesRVM biased implementation which I am working on currently.
It was really interesting that I got a slightly different behavior than the same experiment running on Java6.
It is always the same output, the first thread does all the work, and the other threads display zeros.
Every run, I get a different output: The following are examples of what I got as an output from the little experiment:
$runnable[0]: counter=4
runnable[1]: counter=0
runnable[2]: counter=0
runnable[3]: counter=0
runnable[4]: counter=987

Another one:
$runnable[0]: counter=5
runnable[1]: counter=498
runnable[2]: counter=488
runnable[3]: counter=0
runnable[4]: counter=0
$runnable[0]: counter=1
runnable[1]: counter=990
runnable[2]: counter=0
runnable[3]: counter=0
runnable[4]: counter=0
Ok, I promise this is the last one:
$runnable[0]: counter=117
runnable[1]: counter=875
runnable[2]: counter=0
runnable[3]: counter=0
runnable[4]: counter=0
I run the experiment on my Ia32_linux system and used exactly the same code in the same entry I refer to.
Although the JikesRVM is somehow far from being "fair", I think we are on business. The real question will be how we can increase this fairness without beating the performance of the biased mechanism, or how can we decrease the threads starvations and get the same performance we are aiming for from the biased implementation.
It worth mention that the current implementation beats Java6 in many benchmarks. Stay tuned with more entries about this.

No comments: