Configure template change to use SysV Semaphors on darwin

From: Chris Marcellino <cmarcellino(at)apple(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Configure template change to use SysV Semaphors on darwin
Date: 2007-02-07 21:59:07
Message-ID: 3830CBEB-F8CE-4EBC-BE16-A415E78A4CBC@apple.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom mentioned,
> AFAIK the only platform where the POSIX sema code is really used is
> Darwin (OS X), and it is not something I'd use there if I had a
> choice.
> The problem with it is that *every* semaphore corresponds to an open
> file handle in the postmaster that has to be inherited by *every*
> forked
> child. So N backend slots cost you O(N^2) in kernel filehandles and
> process fork overhead, plus if N is big you're taking a serious hit in
> the number of disk files any one backend can have open. This problem
> may be specific to Darwin's implementation of the POSIX spec, but it's
> real enough there. If you trawl the archives you'll probably notice a
> lack of people running big Postgres installations on Darwin, and
> this is
> why.

I searched through the archives and I can't find a mention of why the
posix_sema code was written for Darwin.
I assume it is because before Darwin 6.0/Mac OS X 10.2 there was not
kernel support for SysV semaphores.

If this is in fact the case, I have a trivial patch to conditionally
enable SysV semaphores based on the OS release:

*** /Users/chrismarcellino/postgresql-8.2.2/src/template/darwin Fri
Mar 10 20:38:40 2006
--- /Users/chrismarcellino/darwin Wed Feb 7 13:56:01 2007
***************
*** 4,8 ****
# (Note: on OS X before 10.2, you might need -traditional-cpp
instead)
CC="$CC -no-cpp-precomp"

! # Select appropriate semaphore support
! USE_NAMED_POSIX_SEMAPHORES=1
--- 4,16 ----
# (Note: on OS X before 10.2, you might need -traditional-cpp
instead)
CC="$CC -no-cpp-precomp"

! # Select appropriate semaphore support. Darwin 6.0 (Mac OS X 10.2)
and higher
! # support System V semaphores for better peformance.
! case $host_os in
! darwin[015].*)
! USE_NAMED_POSIX_SEMAPHORES=1
! ;;
! *)
! USE_SYSV_SEMAPHORES=1
! ;;
! esac

Thanks,
Chris Marcellino

Attachment Content-Type Size
darwin application/octet-stream 487 bytes

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2007-02-07 22:37:44 Re: Re: [COMMITTERS] pgsql: Stamp releases notes for 8.2.3, 8.1.8, 8.0.12.
Previous Message Tom Lane 2007-02-07 20:37:24 Re: [PATCHES] writing new regexp functions