Re: POSIX semaphores?

From: Daniel Eischen (eischen_at_vigrid.com)
Date: 01/30/04

  • Next message: Steve Young: "Re: unusually high load averages"
    Date: Fri, 30 Jan 2004 09:11:09 -0500 (EST)
    To: Andrey Chernov <ache@nagual.pp.ru>
    
    

    On Fri, 30 Jan 2004, Andrey Chernov wrote:

    > Could anybody enlighten me, please?
    >
    > 1) What is current status of POSIX semaphores? Are they at the production
    > quality? Are they better implemented than SYSV ones?
    > 2) What is kernel option to turn them on? Why I don't find it in NOTES or
    > GENERIC?

    You need option P1003_1B_SEMAPHORES. It's in sys/conf/NOTES.

    > The reason why I ever ask is that some ports try to sense POSIX semaphores
    > at configure stage (looking for sem_init()) and then compiled program
    > fails with "Unknown system call" diagnostic.

    They must be trying to use shared semaphores which currently don't
    work across processes (unless they are forked and semaphore is
    created before the fork). The problem is that semaphores (and
    mutexes, condition variables, etc) are all pointers to an
    allocated structure. You can't place this (the pointer) in
    shared memory and have processes other than the creating
    process access it. This probably won't be fixed until
    6.0 because we'll need to change these synchronization
    types to be the actual structures instead of pointers
    (breaking binary compatibility).

    So we do support semaphores, but not pshared semaphores
    even though the library call honors pshared. And if you
    do try to use a pshared semaphore, then the kernel support
    (P1003_1B_SEMAPHORES) has to be there.

    -- 
    Dan (currently reworking semaphores)
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
    

  • Next message: Steve Young: "Re: unusually high load averages"