I found that postgres uses different semaphore system call on some different
operating systems.
For example, I found that on linux, System V semaphore (semop etc.) is used
to implement locking, while on Darwin, POSIX semaphore (sem_wait, sem_post
etc.) is used.
linux and Darwin support both System V and POSIX semaphores, i'm wondering
why postgres implement locking using different types of semaphore system
call. Is there any performance or semantic issue on different OSes?

Thnaks!

Search Discussions

  • Tom Lane at Dec 5, 2010 at 5:07 pm

    flyusa2010 fly writes:
    I found that postgres uses different semaphore system call on some different
    operating systems.
    For example, I found that on linux, System V semaphore (semop etc.) is used
    to implement locking, while on Darwin, POSIX semaphore (sem_wait, sem_post
    etc.) is used.
    linux and Darwin support both System V and POSIX semaphores, i'm wondering
    why postgres implement locking using different types of semaphore system
    call. Is there any performance or semantic issue on different OSes?
    I think your question is answered in src/template/darwin:

    # Select appropriate semaphore support. Darwin 6.0 (Mac OS X 10.2) and up
    # support System V semaphores; before that we have to use POSIX semaphores,
    # which are less good for our purposes because they eat a file descriptor
    # per backend per max_connection slot.
    case $host_os in
    darwin[015].*)
    USE_NAMED_POSIX_SEMAPHORES=1
    ;;
    *)
    USE_SYSV_SEMAPHORES=1
    ;;
    esac

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedDec 5, '10 at 6:37a
activeDec 5, '10 at 5:07p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Flyusa2010 fly: 1 post Tom Lane: 1 post

People

Translate

site design / logo © 2021 Grokbase