Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!astph!jeff From: jeff@astph.UUCP (8592x2) Newsgroups: comp.unix.wizards Subject: shmat() Keywords: shmat() database Message-ID: <37@astph.UUCP> Date: 24 Aug 90 20:25:34 GMT Organization: Philadelphia Phillies Lines: 42 I begun to code my initial shared memory manager after many helpful tips from the net. We have decided to code for the most portable usage of the shmat() system call. It is our goal to run our database on different systems with little or no modification. Thanks for your advice. Our database will work with a server/client process architecture. The server and client will all need access into this shared memory. We plan to allow the system to select the address to map each process into the shared memory. The FM describes how to make the shmat() and allow the system to select the address. With in this shared memory we will use many queues, free queues, record queues, etc. We do not want to use absolute pointers within these queues because the system may allign the shared memory to a different address with each shmat(). Thus we will use offsets from the beginning of the shared memory segment. The queue structures follow. typedef struct { unsigned short offset; /* segment index */ unsigned char segment;/* segment identifier */ } SQUEUE; /* singly linked list queue pointer */ typedef struct { SQUEUE fore; /* fore pointer */ SQUEUE back; /* back pointer */ } DQUEUE; /* doubly linked list queue pointer */ The above structures will provide a relative 'offset' into a shared memory segment and an identifier to a particular memory 'segment'. Thus we can create a large shared memory segment (1 meg max) and provide enough pointers. However if we need more than one meg we can create another shared memory segment and use the 'segment' field to point to another memory segment. Database programmers what do you think? Thanks, jeff martin astph!jeff@psuvax1.psu.edu psuvax1!astph!jeff philadelphia phillies