Re: mutex question



"Tom Widmer" <tom_usenet@xxxxxxxxxxx> wrote in message
news:%2333sd$AdGHA.4224@xxxxxxxxxxxxxxxxxxxxxxx
Slava M. Usov wrote:
"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:uAKjiq3cGHA.4428@xxxxxxxxxxxxxxxxxxxxxxx

Slava M. Usov wrote:


[...]


Reads and writes did happen; your "corrupt" involves an ad hoc
assumption -- the atomicity of reads and writes.

It's neither ad hoc nor an assumption, but a requirement of "sufficient".


Atomicity is a requirement for reading or writing?

Yes. What's your definition of "sufficient" in the context of this thread?

Something is sufficient for externally observable reads and writes when
externally observable reads and writes happen. Atomicity is completely and
entirely irrelevant here.

[...]

That program didn't do anything useful.

Ignoratio elenchi.

[...]

In any case, I believe it can be written more efficiently (without getting
rid of the spin lock) as:

Introducing write and read barriers hardly makes things more efficient.
Introducing MSFT-specific language extensions hardly makes things more
portable.

S


.



Relevant Pages

  • Re: Lock variables between two threads
    ... L2/L3 cache shared between cores), or always an entire word (or ... atomicity of the read/modify/write to the cache line even with ... Reading or writing a byte. ...
    (microsoft.public.vc.language)
  • Re: page table lock patch V15 [0/7]: overview
    ... all the stuff we put in to simulate 64 bit atomicity for i386 PAE mode if ... reading or writing a word aligned on a 16-bit boundary ... that the following additional memory operations will always be carried out ...
    (Linux-Kernel)
  • Re: Memory Consistency Errors
    ... While reading the tutorial http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html, ... It is said that memory consistency errors can occur even when atomicity of reading/writing access is guaranteed with volatile. ... "Atomic actions cannot be interleaved, so they can be used without fear of thread interference. ...
    (comp.lang.java.programmer)
  • Re: How to do atomic read?
    ... is atomic and InterlockedXxxxx functions are not necessary to ... ensure atomicity for reading? ... "vasanth" wrote: ...
    (microsoft.public.development.device.drivers)