[comp.sys.sun] Standard for Shared Memory

chuck@morgan.com (01/04/89)

> Does a shared memory concept exist, not limited by hardware restrictions,
> portable to 'all' unix based systems?

Concepts are extremely portable.

The most available shared memory facility (discounting shared files of
course) is currently System V IPC shared memory: shmget(), shmat(),
shmctl().  These are implemented on most Berekely derived systems as
System V enhancements.  I know for sure that it is supported on such
systems as Sun, HP, Apollo, IBM (AIX), and Xenix.  However, most Berkeley
implementations do not yet include some of the more recent AT&T
enhancements such as shared memory segment locking, paging vs. non-paging
shared memory, etc...

My new favorite form of shared memory are memory mapped files (see
mmap()).  I am not sure how available memory mapped files are currently;
certainly less available than System V shared memory.  IBM's AIX does
provide equivalent functionality to mapped files by providing additional
options to the shmget() call.

My recommendation to anyone who wants to be as portable as possible is to
write a layer on top of the appropriate shared memory facility on your
machine.  When you get a new machine with different facilites, add some
more ifdefs to your shared memory layer source and the rest of your code
remains untouched.

Chuck Ocheret
Morgan Stanley & Co., Inc.
1251 Avenue of the Americas
New York, N.Y. 10020
(212)703-4474