Tom mentioned,
AFAIK the only platform where the POSIX sema code is really used isDarwin (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 openfile handle in the postmaster that has to be inherited by *every* forkedchild. 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 alack of people running big Postgres installations on Darwin, and this iswhy.
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
darwin
Description: Binary data
---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org