Re: removing store/load in Peterson's algorithm?
- From: Dmitriy Vyukov <dvyukov@xxxxxxxxx>
- Date: Thu, 24 Dec 2009 02:50:44 -0800 (PST)
On Dec 23, 10:29 pm, "James" <n...@xxxxxxxxxxxx> wrote:
"Dmitriy Vyukov" <dvyu...@xxxxxxxxx> wrote in message
news:756561b8-810a-40ef-99e1-ff7138e13661@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 21, 8:32 pm, "James" <n...@xxxxxxxxxxxx> wrote:
[...]
STORE16(&state1, 1);
LOAD32(&state1);
LOAD32(&state2);
Can the load from state2 rise above the 16-bit store? It seems like
it
should be able to. Where am I going wrong?
[...]Yes, it can. But there is no such code in Peterson algorithm, there is
only 1 load.
I was referring to a load that occurred within the critical section. CanI can only cite myself:
loads from the critical section rise above the 16-bit store? Can that
cause
any problems?
I think one need only #LoadLoad | #LoadStore:
STORE16(&state, 1);
LOAD32(&state);
if (...) ...
membar #LoadLoad | #LoadStore; //no-op for SPARC TSO and x86
// nothing from here can hoist above mutex acquisition
But the:
STORE16(&state, 1);
LOAD32(&state);
will not prevent a store from within the critical section from rising above
it. This would mess things up right?
It depends on hardware.
On IA-32, Intel64, SPARC TSO it won't mess.
On IA-64, SPARC RMO it can.
--
Dmitriy V'jukov
.
- References:
- removing store/load in Peterson's algorithm?
- From: James
- Re: removing store/load in Peterson's algorithm?
- From: Dmitriy Vyukov
- Re: removing store/load in Peterson's algorithm?
- From: James
- Re: removing store/load in Peterson's algorithm?
- From: Dmitriy Vyukov
- Re: removing store/load in Peterson's algorithm?
- From: James
- Re: removing store/load in Peterson's algorithm?
- From: James
- Re: removing store/load in Peterson's algorithm?
- From: Dmitriy Vyukov
- Re: removing store/load in Peterson's algorithm?
- From: James
- Re: removing store/load in Peterson's algorithm?
- From: Dmitriy Vyukov
- Re: removing store/load in Peterson's algorithm?
- From: James
- removing store/load in Peterson's algorithm?
- Prev by Date: Re: removing store/load in Peterson's algorithm?
- Next by Date: Re: removing store/load in Peterson's algorithm?
- Previous by thread: Re: removing store/load in Peterson's algorithm?
- Next by thread: Re: removing store/load in Peterson's algorithm?
- Index(es):
Relevant Pages
|