Re: fork/exec - Mailing list pgsql-hackers-win32

From Tom Lane
Subject Re: fork/exec
Date
Msg-id 24103.1070213411@sss.pgh.pa.us
Whole thread Raw
In response to Re: fork/exec  (Claudio Natoli <claudio.natoli@memetrics.com>)
List pgsql-hackers-win32
Claudio Natoli <claudio.natoli@memetrics.com> writes:
> Would it be possible to re-jig ShmemInitStruct to not require locking

That strikes me as entirely unsafe.

Back when we actually had fork/exec for Unix, there were three shmem
segments not one.  Part of the reason for this was that spinlocks
occupied their own segment, and so they could be found and accessed
without any reference to the main shmem index.  (I forget what the
third segment was for, but I think it was not critical for startup.)

Probably the best way to model this now is to put a pointer (or whatever
is needed) to the LWLock array into the shmem segment header, whence
it can be grabbed without any locking.  This will allow a new backend's
lock manager to be initialized immediately.  Then we can safely (ie,
with locking) initialize access to the shmem index hashtable (it might
take another pointer in the segment header to find it) and then
everything else can be looked up in the index hashtable.

            regards, tom lane

pgsql-hackers-win32 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: fork/exec
Next
From: Claudio Natoli
Date:
Subject: Re: fork/exec