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: 2001-11-23 20:14:01
Message-ID: 200111232014.fANKE1Y01370@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


I want to comment on this patch. The author is not happy to have all
his QNX6 work wait for 7.3 so I suggested he split the patch in two:
one part that is seen only by QNX and regression stuff, and a second
patch that adds Posix semaphore support. I think the first part can be
put into 7.2 if we can all be sure it is seen only by QNX.

FYI, we support QNX4, but not QNX6 at this point.

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

> 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

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Igor Kovalenko 2001-11-24 09:06:44 Re: Support for QNX6, POSIX IPC and PTHREAD-style locking
Previous Message Bruce Momjian 2001-11-23 19:13:37 Re: Added Encoding