Wednesday, November 26, 2008

How slow is CMPXCHG?

In order to understand this, I profile one of the amino lock-free data structure and get following result:

Synchronization is expensive!

Data is collected with run.tprof and visualized by VPA.

3 comments:

bin.fan said...

Yes, I have same experience. What can we do about that?

James Gan said...

We can try our best to reduce the number of synchronization.

There are some successful examples:
1. Biased locking in JVM
2. FIFO Queues by Edya Ladan-Mozes and Nir Shavit, 2004

bin.fan said...

Thanks! these works are interesting.