Re: [Sablevm-developer] Threading support in SableVM
Brought to you by:
egagnon
From: Archie C. <ar...@de...> - 2004-02-23 15:57:12
|
Chris Pickett wrote: > > The inflating of the "other" locks is to avoid this inefficiency. > > But it's not necessary to do this for threads waiting on the actual > > lock being released, because you do indeed want those thread to > > wake up. > > I understand and agree with most if not all of that, certainly > pertaining to the other locks. I guess I was wondering, wouldn't things > be *faster* if you inflated the actual released thin lock, because you > wouldn't have to take the (what I assumed/am assuming to be slow) > inflation path for that lock again when future contention arose? A lock can only be inflated once. So it's never slower to delay this inflation to a later point. But more importantly, the inflation does not necessarily have to happen. When thread #1 releases the thin lock, it wakes up thread #2. Then thread #2 retries its lock acquisition "from the beginning". If no other threads beat it out, then thread #2 sees an unlocked thin lock and acquires it using compare-and-swap. So no inflation takes place in this case. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com |