CMS parallel initial mark; vm thread sneaking in Thread::try_lock()

Hiroshi Yamauchi yamauchi at
Wed Jun 19 17:35:47 UTC 2013

> Thanks. If we only call try_lock() and unlock() on a mutex/monitor, then
>> no thread will block due to a safepoint synchronization inside that
>> mutex/monitor (as I see no ThreadBlockInVM in try_lock()). That is, we
>> won't encounter a situation where a VM thread sneak may happen, and we
>> don't need to worry about sneaking. Is that right?
> If all access to the lock is via try_lock() then no thread will block
> acquiring that lock due to a safepoint. If all other threads using the lock
> are JavaThreads (and obey the safepoint protocol) then the VMThread will
> never sneak it because it will never see it unowned unless it is actually
> unlocked. And of course the VMThread should then only ever see it unlocked
> (it doesn't strictly matter of the VMThread is using try_lock, but if the
> VMThread sees it locked then it means that the lock owner has hit a
> safepoint check while holding the lock [ and blocked] and that is generally
> undesirable.

Thanks, David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the hotspot-gc-dev mailing list