Skip to main content

Will lock-contention always leed to heavyweight locks?

2 replies [Last post]
Joined: 2004-01-07

Hi there,

I am writing an server-side application which should be as scalable as possible even from its design.

I am a bit concerned about lock-contention, will a contended lock always be turned into a heavyweight one - and is hotspot able to migrate a heavyweight lock back to a lightweight one if appropriate?
Will the lightweight lock spin some time before it gets a heavyweight one?
Does anybody know links with explanations of hotspots heuristics?

Thank you in advance, lg Clemens

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-08-27

Contended locks are converted into heavyweight locks (we say the lock is "inflated") after a brief spin attempt. Deflation occurs lazily at the next stop-the-world point. In 6.0 the JIT now inlines the inflated "fast path" directly at the synchronization site.

See and for additional details.


Joined: 2004-01-07

Thanks a lot for this detailed answer - well I already thought that hotspot is quite clever about this, however I never imagined it would be that clever.

Thanks for the links, very, very interesting stuff!

lg Clemens