Re: LWLock/ShmemIndex startup question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>
Cc: "''''pgsql-hackers(at)postgresql(dot)org' ' ' '" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LWLock/ShmemIndex startup question
Date: 2004-01-13 14:54:23
Message-ID: 11176.1074005663@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com> writes:
> FWIW, I've done a code walk-through, and it looks ok (lack of real-world
> testing notwithstanding), and actually does use the Win32 sema set. The only
> real problem is that it calls ShmemInitStruct in semget, which ultimately
> gets us into bootstrap hell (without native spinlocks, at least).

Right. The advantage of the pg_sema.h API is that you don't need any
shared control data. Take a close look at the way posix_sema works:
the management information needed to release the semas at shutdown is
private to the postmaster. What is in shared memory need only be a
reference or token (whatever you have to hand to the lock/unlock calls).
Also, allocation of the shmem space is not the responsibility of the
startup routine. So all these issues go away as long as you're not
trying to emulate the SysV interface.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-01-13 14:57:05 Re: LWLock/ShmemIndex startup question
Previous Message Merlin Moncure 2004-01-13 14:54:13 Re: [pgsql-hackers-win32] Win32 signal code - first try