Shared memory mapping question.
Conor P. Cahill
cpcahil at virtech.uucp
Sat Mar 24 00:15:15 AEST 1990
In article <9464 at discus.technion.ac.il> devil%techunix.bitnet at jade.berkeley.edu (Gil Tene) writes:
>My problem is : How do i "allocate" a specific area in process virtual space,
>in order to map the shared memory into it. How can i specify this virtual
>process address as a constant, and where do i take it from (top of user
>vir. address space, etc.). Allocating using sbrk() or malloc() variaties,
>doesn't give me any way to control the exact address of the allocated block...
Pulling an old response out of the saved bucket:
From cpcahil Wed Nov 1 09:37:04 1989
Path: virtech!cpcahil
From: cpcahil at virtech.uucp (Conor P. Cahill)
Newsgroups: comp.unix.questions
Subject: Re: Shared memory and pointers
Message-ID: <1989Nov1.143704.9258 at virtech.uucp>
Date: 1 Nov 89 14:37:04 GMT
References: <525 at wizard.UUCP>
Distribution: usa
Organization: Virtual Technologies Inc.
Lines: 24
In article <525 at wizard.UUCP>, john at wizard.UUCP (John Danner) writes:
> 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.
I have seen 2 solutions to these problems.
1. have the first program that creates the shared memory segment
attach it at whatever address it determins is appropriate and
then writes said address into the first 4 bytes of the shared memory
segment itself. All follow on program will attach the segment at the
default address, read the address that it should be attached at,
detach it, and finally re-attach it at the appropriate address.
2. keep track of data using relative pointers (offset from the
begining of the shared memory segment) this is a real bear.
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.,
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
More information about the Comp.unix.wizards
mailing list