home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16460 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.5 KB  |  61 lines

  1. Newsgroups: comp.lang.c++
  2. 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
  3. From: eny@ermes.enea.se (Erik Nykvist)
  4. Subject: Re: C++ and Shared Memory (Was: Linked Lists in Shared Memory: )
  5. Message-ID: <1992Nov16.193935.10319@ermes.enea.se>
  6. Organization: Project ERMES, Teli Telecom Sweden
  7. References: <1992Nov11.202728.7564@lsil.com>
  8. Date: Mon, 16 Nov 1992 19:39:35 GMT
  9. Lines: 50
  10.  
  11. ameesh@lsil.com (Ameesh Desai) writes:
  12. > In article 22735@ermes.enea.se, eny@ermes.enea.se (Erik Nykvist) writes:
  13. > >> >=========
  14. > [stuff deleted]
  15. > >The proposed technique uses the new-operator  with placement-syntax to
  16. > >fix the vtbl-pointer in the object. 
  17. > >I have not thought about this very much. I have written ONE example
  18. > >program that uses this. 
  19. > >My idea is that if you know the address of the object in shared memory
  20. > >you could access it after having fixed the vtbl-pointer.
  21. > >If you fork your process it is NOT necessary to fix the vtbl-pointer
  22. > >because the forked process has the vtbl at the same address as the
  23. > >parent process.
  24. > >
  25. > >Erik Nyquist
  26. > >
  27. > I guess if all processes that were to access the shared mem were to have the
  28. > same parent (forked from one single process), what you say is true. However,
  29. > in a more general case, you would like to provide access to the shared 
  30. > memory to processes that do not share the same parent.
  31. > It is not clear to me if there is a "clean" way to share the pages simultaneously
  32. > accross such processes. (when the pages contain C++ objects with vtbl ptrs).
  33. > Ameesh
  34. My idea was to change the value of the vtbl-pointer each time a
  35. context switch occurs. 
  36. There are many disadvantages with this approach. 
  37. One is that only one process may call virtual functions for the object at
  38. the same time. Another one is that it is difficult to design a
  39. constructor that doesn't change the object.
  40.  
  41. The opposite approach seen in some articles is to make certain that the 
  42. vtbl-address doesn't have to change when a contex switch occurs. This
  43. method requires that the executables are linked in a way that
  44. guarantees that the same address is used for the vtbl in both
  45. processes. 
  46. The only problem with this approach is that it is linker-dependent. 
  47.  
  48. Well, ...
  49.  
  50. Erik Nyquist email: erny@enea.se
  51.  
  52.  
  53.  
  54.