harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@apache.org>
Subject Re: [drlvm][jitrino]
Date Sat, 15 Dec 2007 13:34:01 GMT
On 15 декабря 2007 史成荣 wrote:
> 2007/12/15, Gregory Shimansky <gshimansky@apache.org>:
> > On 15 December 2007 史成荣 wrote:
> > > I still have 2 questions.
> > >
> > > First, I know in the Thread Manager, it is the
> > > hythread_thin_monitor_try_enter method to aquire the mutex lock
> > > and implement the *memory barrier.* But* *I looked into the code of
> > > this method, didn't find any memory barrier operations(including the
> > > apr_memory_rw_barrier() call and  cmpxchg operation) when it is the fat
> > > lock. when aquiring the fat lock, it calls the
> >
> > hythread_monitor_try_enter
> >
> > > method. In the hythread_monitor_try_enter method* there isn't *memory
> > > barrier operations, but has a call of the *hymutex_trylock* method.
> > > Does the hymutex_trylock method also has barrier effect built-in?
> >
> > Fat monitors use OS synchronization primitives. You can take a look in
> > vm/thread/src/{win,linux}/os_mutex.c files to see the exact
> > implementation.
>
> I had taken a look into vm/thread/src/{win,linux}/os_mutex.c files, and
> found pthread_mutex_trylock(linux) and TryEnterCriticalSection(win)
> methods. Do you mean the two methods not only have mutex lock function, but
> also have barrier effect?

They do all (you can be sure about it) of the necessary synchronization stuff 
since they go into the OS kernel. In case the processor architecture needs 
memory barriers they do it.

-- 
Gregory

Mime
View raw message