PostgreSQL performance on FreeBSD

Jilles Tjoelker jilles at
Thu Jun 23 22:31:47 UTC 2016

On Wed, Jun 22, 2016 at 07:26:52AM -0700, Maxim Sobolev wrote:
> Konstantin,

> Not if you do sem_unlink() immediately, AFAIK. And that's what PG does. So
> the window of opportunity for the leakage is quite small, much smaller than
> for SYSV primitives. Sorry for missing your status update message, I've
> missed it somehow.

True, but if your process architecture supports that, you can also put
unnamed process-shared semaphores into a piece of shared memory (pad
sem_t to a cache line if contention is expected). This is more natural
API use (fully avoiding the leak) and uses less memory. It has been
supported for a long time, at least since FreeBSD 9.0.

Process-shared mutexes, condition variables, reader/writer locks, etc.
are available in FreeBSD 11 but use more memory (a 1-page object per
synchronization object), somewhat like named semaphores.

Jilles Tjoelker

More information about the freebsd-performance mailing list