Re: Support for QNX6, POSIX IPC and PTHREAD-style locking

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Igor Kovalenko <Igor(dot)Kovalenko(at)motorola(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Support for QNX6, POSIX IPC and PTHREAD-style locking
Date: 2002-02-22 23:19:13
Message-ID: 200202222319.g1MNJD505687@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Igor Kovalenko wrote:
> Here is the patch which adds following things to 7.2:
>
> 1. Support for QNX6 (builds cleanly on stock installation and passes all
> regression tests).
>
> 2. HAVE_POSIX_IPC feature, which if enabled switches implementation of
> IpcSemaphoreXXX() (ipc.[ch]) to POSIX semaphores and mmap(). Enabled on QNX6
> but should be useful for lot of platforms. Since IpcSemaphoreCreate() really
> assumed SysV semaphores, I had to change its prototype *when* this feature
> is enabled. That function is called from proc.c and spin.c, which were
> patched accordingly for POSIX case (with #ifdef guards).
>
> 3. USE_PTHREAD_MUTEXES feature, which if enabled implements S_LOCK stuff
> with PTHREAD mutexes. It is useful (better than spinlocks) on non-SMP
> systems when overhead of kernel call is small compared to overhead of
> scheduling. Enabled on QNX6.
>
> 4. USE_PTHREAD_SPINLOCKS feature which if enabled implements S_LOCK stuff
> with PTHREAD spinlocks (may not be available on all platforms). It might be
> better on SMP systems when hardware does not support TAS (in which case SysV
> semaphores would be used as of now and it is hard to be worse than that).
> MIPS systems come to mind (and QNX6 runs on them, so it will be enabled on
> QNX6 in such cases).
>
> I haven't put checks for (2), (3) or (4) into configure to not break
> supported platforms in unexpected ways. Benefits of (3) and (4) are really
> OS and hardware dependent, so if you think they could be useful for your
> platform, they have to be enabled in appropriate OS-specific header.
>
> Same for HAVE_POSIX_IPC, but that one in fact can be useful on lot of
> platforms. I've seen benchmark suggesting POSIX semaphores are 4 times
> faster on Linux than SysV ones. It certainly applies to QNX4 as well and
> makes emulation of SysV stuff unnecessary. I believe it could be extended to
> support platforms like Darwin and BeOS which currently also rely on SysV
> emulation. If there's interest from involved people, we could come up with a
> better unified abstraction model and implementations for all supported
> platforms...
>
> I've been warned it might be considered too 'major' for 7.2, but please look
> at the patch before judging. I tried my best to not break existing stuff,
> all changes are only activated when explicitly enabled, QNX6-specific or
> obviously compatible (the only 'unguarded' changes are typecasts for things
> like SemId = -1, since its type is pointer in case of POSIX and fix for
> broken QNX qsort() which I believe is already commited into CVS). I've spent
> considerable time doing this and would really appreciate if it went into
> 7.2. Code builds and runs clean with or without any of above features
> enabled.
>
> The patch generated as recursive GNU-diff between original 7.2b2 and patched
> (+ make distclean) top level directories, like 'diff -crP pgsql-original
> pgsql-patched'.
> It is big mostly because it contains whole new files for QNX6 (-P treats
> missing files as empty).
>
> regards,
> - igor
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-02-22 23:20:34 Re: PQunescapeBytea libpq function
Previous Message Tom Lane 2002-02-22 23:10:15 Re: Fix command completion for CREATE TABEL ... AS