[comp.unix.questions] Shared memory and pointers

john@wizard.UUCP (John Danner) (10/27/89)

We have a server application running with a group of client applications 
locally.  We would like to use shared memory to allow the clients to look
at the data which comes from a database, without having to use a message
passing scheme.  If some of the data includes pointers to other data, what
is a good way to handle this in shared memory?  The problem of course is
that clients may map shared memory blocks to different addresses, so a pointer
to some address in the server's shared memory probably won't point to the
right place on a client.  Two solutions have been proposed from people in our
group, neither of which are very clean.  First, make sure that every client
maps each block of shared memory to the same location.  Second, replace
pointers with something like objectID's and keep a table on the server which
has block #'s and offsets for each objectID.  

The first just seems ugly, and the second is not very transparent to the
writer of the client.  I'm sure there are quite a few people out there who
have dealt with this problem and wouldn't be surprised if there weren't some
good papers to read about it.  Any info would be greatly appreciated.


John Danner       Tandem Computers, Inc.
Net: pacbell!tandem!wizard!john@decwrl.dec.com
UUCP:...!decwrl!pacbell!tandem!wizard!john

barmar@kulla (Barry Margolin) (10/28/89)

In article <525@wizard.UUCP> john@wizard.UUCP (John Danner) writes:
>  Second, replace
>pointers with something like objectID's and keep a table on the server which
>has block #'s and offsets for each objectID.  

Replace the pointers with a structure containing the block number and
offset.

Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar