Re: visibility maps - Mailing list pgsql-hackers

From Zdenek Kotala
Subject Re: visibility maps
Date
Msg-id 494116AC.8050701@sun.com
Whole thread Raw
In response to Re: visibility maps  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
Responses Re: visibility maps
List pgsql-hackers
Pavan Deolasee napsal(a):
> On Thu, Dec 11, 2008 at 5:01 PM, Zdenek Kotala <Zdenek.Kotala@sun.com> wrote:
>> IIRC, Memory reading/writing is atomic operation. Only one CPU(hw thread)
>> can access to the same memory address(es)* in same time*. The question is
>> how compiler compile C code to assembler.  But this code seems to me safe.
> 
> Yeah, I think the code is safe because we are just reading a bit.
> 
> BTW, I wonder if we need to acquire EXCLUSIVE lock while writing the
> visibility map bit ? 

Yes, because it is not simple write operation. You need to read byte from memory 
to register, set bit and write it back. Write memory itself is atomic but 
somebody could change other bits between read and write.
    Zdenek



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Refactoring SearchSysCache + HeapTupleIsValid
Next
From: "Pavan Deolasee"
Date:
Subject: Re: visibility maps