harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: [harmony][Thread]
Date Wed, 19 Dec 2007 01:50:31 GMT
On Dec 19, 2007 9:24 AM, 史成荣 <icyrong@gmail.com> wrote:
> 在07-12-18,Xiao-Feng Li <xiaofeng.li@gmail.com> 写道:
> >
> > Chengrong, locking is expensive, which should be optimized or avoided.
> > The fast path acquiring the lock without Java-native border crossing
> > can be much fast. It's expected the fast path be executed in most
> > cases. This is possible if the code sequence doesn't trigger garbage
> > collection or exception, hence no need to bookkeeping the frames.
>
>
> Does that mean if the code sequence  triggers garbage
> collection or exception, the thread requiring or releasing the lock will
> first take the fast path, and it must return lock-busy, then it goes to the
> slow path and eventually finish the lock operation?

The sequence is like this: it always tries the fast path at first; if
it succeeds in most cases, it simply return. Otherwise, when it
realizes it can't simply acquire the lock due to (a). the lock is held
by other or (b). the lock has incorrect state, it will switch to slow
path to (aa). wait for the lock be released or (bb). to throw
exception. Actions (aa) and (bb) need to bookkeep the frames for
(aaa). garbage collection and (bbb). stack unwinding.

Thanks,
xiaofeng
>
> > Thanks,
> > xiaofeng
> >
> >
>



-- 
http://xiao-feng.blogspot.com
Mime
View raw message