home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!utcsri!newsflash.concordia.ca!garrot.DMI.USherb.CA!uxa.ecn.bgu.edu!mp.cs.niu.edu!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!caen!destroyer!gumby!yale!yale.edu!ira.uka.de!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!enea!ermes!eny
- From: eny@ermes.enea.se (Erik Nykvist)
- Subject: Re: C++ and Shared Memory (Was: Linked Lists in Shared Memory: )
- Message-ID: <1992Nov16.193935.10319@ermes.enea.se>
- Organization: Project ERMES, Teli Telecom Sweden
- References: <1992Nov11.202728.7564@lsil.com>
- Date: Mon, 16 Nov 1992 19:39:35 GMT
- Lines: 50
-
- ameesh@lsil.com (Ameesh Desai) writes:
- > In article 22735@ermes.enea.se, eny@ermes.enea.se (Erik Nykvist) writes:
- > >> >=========
- >
- > [stuff deleted]
- >
- > >The proposed technique uses the new-operator with placement-syntax to
- > >fix the vtbl-pointer in the object.
- > >I have not thought about this very much. I have written ONE example
- > >program that uses this.
- > >My idea is that if you know the address of the object in shared memory
- > >you could access it after having fixed the vtbl-pointer.
- > >If you fork your process it is NOT necessary to fix the vtbl-pointer
- > >because the forked process has the vtbl at the same address as the
- > >parent process.
- > >
- > >Erik Nyquist
- > >
- >
- >
- > I guess if all processes that were to access the shared mem were to have the
- > same parent (forked from one single process), what you say is true. However,
- > in a more general case, you would like to provide access to the shared
- > memory to processes that do not share the same parent.
- >
- > It is not clear to me if there is a "clean" way to share the pages simultaneously
- > accross such processes. (when the pages contain C++ objects with vtbl ptrs).
- >
- > Ameesh
- >
- My idea was to change the value of the vtbl-pointer each time a
- context switch occurs.
- There are many disadvantages with this approach.
- One is that only one process may call virtual functions for the object at
- the same time. Another one is that it is difficult to design a
- constructor that doesn't change the object.
-
- The opposite approach seen in some articles is to make certain that the
- vtbl-address doesn't have to change when a contex switch occurs. This
- method requires that the executables are linked in a way that
- guarantees that the same address is used for the vtbl in both
- processes.
- The only problem with this approach is that it is linker-dependent.
-
- Well, ...
-
- Erik Nyquist email: erny@enea.se
-
-
-
-