Shared memory and IPC

Green, Paul Paul.Green at stratus.com
Fri Sep 7 12:15:12 GMT 2001


My advice is to avoid MAP_FIXED at all costs.  The list of issues you face
is daunting.  Some operating systems may not support this feature. You may
conflict with Oracle or DB2 or some piece of user application code that also
uses shared VM. The startup/initialization code will be complex and slow.
Debugging this code initially, and then supporting it when it is in the
hands of the users, will be tough. Quick, how many of those OSes have
multi-process, real-time debuggers?

PL/I has the exact data type needed for this sort of thing; an "offset" that
is relative to the base of a specified "area". The compiler knows the
association and automatically adds the address of the area to the offset
before dereferencing the pointer.  (And the reverse when assigning to the
offset value).  C has macros (I love C...not).  With suitable O-O style
macros you can reliably hide the transformation from the programmer.  In
fact, consider using C++ instead of C, to get real O-O support.  Using
offsets also has the advantage that you can move the area around, or even
write it out to disk, and read it back in somewhere else, and it is still
valid. 

Keep it simple. Build it and get it working. Optimize the performance by
measuring where the actual app spends its time.

PG
--
Paul Green, Senior Technical Consultant, Stratus Computer, Inc.
Voice: +1 978-461-7557; FAX: +1 978-461-3610; Video on request.
Speaking from Stratus not for Stratus








More information about the samba-technical mailing list