logo       

Why is ReentrantLock faster than synchronized ?: msg#00030

java.jsr.166-concurrency

Subject: Why is ReentrantLock faster than synchronized ?

Hi,

a recent article by Brian Goetz made me wonder about this again. Brian
demonstrates, how ReentrantLock has a performance and scalability
advantage over synchronized.

Did anyone investigate why that would be the case? Is it due to the fact
that the VM has lock-enable *any* java.lang.Object through things like
header displacement, lock inflation/deflation? Or has GC an advantage
over manual management of lock records?

Other than that I cannot think of any edge ReentrantLock could have over
synchronized: both codes are generated inline by the Hotspot compiler,
both can and probably do use the same suspension/resumption methods, the
same atomic instruction sequences, ...

Just wondering
Matthias
--
Meet us at CeBIT: Launching CoreMedia CMS 2005, Hall 3, D09.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise