[omniORB] Lockup on Solaris 2.5.1 with Y2K patch
David.Chung@USPTO.GOV
David.Chung@USPTO.GOV
Tue, 22 Jun 1999 13:14:17 -0400
Even though
while(!died)
translates into many machine instructions, the only relevant machine
instruction is the read of "died" variable. In this case, other
instructions,
such as branching, are not part of the critical section.
Only the critical section requires synchronization protection.
However, the critical section, (the read of "died" variable), is already
protected,
because the read instruction IS guaranteed to be atomic at machine level.
(At least on Intel architectures and more contemporary 32-bit
hardware architectures).
The preceding is true regardless of compiler optimizations.
Compiler
optimizations still results in assembler instructions set -- the "move"
assembler instruction cannot be made into something "unatomic" by
compiler optimization.
All synchronization operations are computationally expensive.
If one can do without them, one should. Each synchronization function
call translates into expensive machine instructions (about 20 times
slower).
> -----Original Message-----
> From: harald.hopfes@vs.dasa.de [SMTP:harald.hopfes@vs.dasa.de]
> Sent: Tuesday, June 22, 1999 10:46 AM
> To: Chung, David
> Cc: omniorb-list@uk.research.att.com
> Subject: Re: [omniORB] Lockup on Solaris 2.5.1 with Y2K patch
>
> First, even if the 4-byte read is an atomic, the following piece of code,
> isn't just a (4-byte) read:
> while(!died)
> It conains at least the (4-byte) read, a "COMPARE" and a "BRANCH"
> assembler
> instruction.
>
> Even so, I think it should not be necessary to protect it, but you never
> know
> how the compiler
> optimizes this piece of code: So I prefer to be on the save way.
>
> Another question: Do you know the instruction set of your computer and
> which
> kind of optimizations
> it uses? I don't!
>
> Harald
>