Nameless IPC on POSIX systems

Поиск
Список
Период
Сортировка
От des@des.no (Dag-Erling Smørgrav)
Тема Nameless IPC on POSIX systems
Дата
Msg-id 868y2s1qge.fsf@xps.des.no
обсуждение исходный текст
Ответы Re: Nameless IPC on POSIX systems  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
The attached patch implements new semaphore and shared memory
mechanisms for POSIX systems.

Semaphores are implemented using unnamed pipes.  A semaphore is
incremented by writing a single character to the pipe, and decremented
by reading a single character.  The only semaphore operation we can't
reliably simulate in this manner is sem_getvalue(), but PostgreSQL
doesn't use it.

Shared memory is implemented using file-less (swap-backed) mmap(),
either with MAP_ANON on systems which support it, or with /dev/zero
(SysV-style).  Note that I've only tested this on systems which
support MAP_ANON, so there may be bugs in the /dev/zero code.

One system which will definitely benefit from this is FreeBSD.
FreeBSD has both SysV and POSIX semaphores and shared memory, but
unnamed POSIX semaphores can't be shared between processes, and POSIX
shared memory is implemented using plain files, so the POSIX
primitives can't be used.  The SysV primitives use a global namespace,
which causes problems when multiple PostgreSQL instances run in
separate jails (they can't run on the same port, and a compromised
postmaster in one jail can be used to crash postmasters in other
jails)

The patch was developed and tested on FreeBSD 6, and has also been
tested cursorily on SuSE Linux 9.2.  It passes 'make check', and osdb
(for what it's worth) shows no difference in performance between
patched and unpatched postmasters built from the same source.

Remember to run autoconf and configure before testing, as the patch
modifies configure.in and the FreeBSD and Linux templates.

DES
--
Dag-Erling Smørgrav - des@des.no


Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Emmanuel Bernard
Дата:
Сообщение: Blob .getBytes position should start at 1
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Nameless IPC on POSIX systems