Re: WaitForSingleObject() will not deadlock



But what is TSO? According to wikipedia

TSO is a three letter abbreviation commonly used to represent:

Science:

TCP segmentation offloading
Technical Standard Order, a minimum performance standard issued by the FAA for certain
items used on civil aircraft.
Time Sharing Option, an interactive command line interpreter for IBM mainframe operating
systems MVS/ESA, OS/390 and z/OS
Transmission System Operator
Other:

Tasmanian Symphony Orchestra
Tax Service Office
Territory Sales Organization
The Sacred Octagon, the bi-monthly journal of the New England MG T Register (an
organisation of MG enthusiasts)
The Sims Online, a massively multiplayer game.
The Singular Online, a massively multiplayer RPG game.
The Special One, a nickname of Chelsea Manager José Mourinho
The Stationery Office, publishers
Tokyo Symphony Orchestra
Toronto Symphony Orchestra
Trans-Siberian Orchestra
The ICAO code for Transaero
Transportation security officer
A local Sorority at Knox College, Galesburg, IL
Total Shares Outstanding, a financial term referring to the stock held by investors,
including restricted shares, as well as those held by the public
Tourist Standard (or Second) Open, a type of British Railways coach.

None of these seem to apply.
*****
On Thu, 05 Jul 2007 17:04:34 -0700, Frank Cusack <fcusack@xxxxxxxxxxx> wrote:

On Tue, 03 Jul 2007 13:53:09 -0400 Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:
It seems that "memory visibility" has something to do with making
sure that results are in memory. I would have thought this would
have been more commonly referred to as the "cache coherency"
problem.

They are 2 different problems, but because x86 is TSO, they are
equivalent for that platform.

Because of the Interlocked operation used on the x86 and
x64, all results in caches and pipes are guaranteed to be in a
consistent state throughout the entire multiprocessor cache
structure. Therefore, once you have acquired any locking object,
you are guaranteed that all processors are seeing the same memory
contents, one way or another.

That is true for all processors, but this is because acquisition of a
lock is guaranteed to issue a membar, not because of cache coherency.
*****
This is particularly an issue because of the write-combining cache of the newer Pentium
models.
*****

Strictly speaking, shared variables should be declared 'volatile' to
ensure the compiler has not kept a copy around, and this is

Strictly speaking, this is not correct. But the MS VC definition
of volatile is different than the ISO C definition. This has been
discussed to death on comp.programming.threads. Again and again.

completely orthogonal to the concept of locking; it appears that the
Microsoft C/C++ compiler is very conservative about code motions
across functions and therefore seems less subject to this kind of
error, although the formal requirements of the C/C++ language would
dictate that the use of 'volatile' is mandatory to ensure the
compiler has not done something bad.

Not correct. volatile (the ISO C definition) does no such thing.
A mutex is sufficient to guarantee visibility, and the compiler
is guaranteed not to reorder code around locking operations.
****
There's a good discussion of these issues in

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1777.pdf
*****

-frank
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Segfault City
    ... Realizing ... What, if anything, can it be guaranteed will be> '9' in standard C? ... there /isn't/ any guarantee of a character greater than '9' in C. ...
    (comp.lang.c)
  • Re: HashMap vs linear table lookup
    ... statement such as yours ("the hashCode for a String is computed once ... specifically says that all implementations must cache the hash code, ... Is there in fact a genuine guarantee that every implementation ...
    (comp.lang.java.programmer)
  • Re: Segfault City
    ... Andrew Poelstra wrote: ... What, if anything, can it be guaranteed will be> '9' in standard C? ... Perhaps I should have studied English more in high school at East ... there /isn't/ any guarantee of a character greater than '9' in C. ...
    (comp.lang.c)
  • Re: questions on ftell and fopen
    ... foo: ... actually guarantee that a failing fopensets errno. ... A standard is a contract between the implementer and the programmer. ...
    (comp.lang.c)
  • Re: Why GCC does warn me when I using gets() function for accessing file
    ... that on my system int is 17 bits or more, I can guarantee I haven't [invoked ... The C standard says nothing about such ... it actually overruns the buffer. ... to be well defined the spec has to specify something ...
    (comp.lang.c)