From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Magnus Hagander <mha(at)sollentuna(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Win32 open items |
Date: | 2004-10-31 02:48:24 |
Message-ID: | 200410310248.i9V2mOG14849@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Magnus Hagander wrote:
> >We don't need the cancelConnLock if this is done properly (at least,
> >assuming that storing a pointer is atomic, which seems reasonable).
>
> Are you sure about this?
> Per what docs I have, storing a pointer should always be atomic.
> exchanging two pointers are not, which is why at least win32 provides a
> specific function to do that (InterlockedExchangePointer).
You can't even assume a pointer write is atomic to all threads if you
have multiple CPUs. Assume two CPU's. Even if CPU 1 writes the pointer
atomically, there is no guarantee that the other CPU will see the change
at the same time. To guarantee it, you need a memory barrier like a
lock/unlock. Some CPU systems guarantee memory conherency for memory
operations, but some do not.
It is temping to think that if one CPU can write a value atomically then
the other CPU will also see it at the same time, but that isn't
guaranteed.
For the hardware issues see:
http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-toolbox.html
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | a_ogawa | 2004-10-31 14:29:37 | Re: Cache last known per-tuple offsets to speed long tuple |
Previous Message | Euler Taveira de Oliveira | 2004-10-30 23:13:40 | Translation updates: pt_BR |