single object across processes

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default single object across processes

    Hi,
    Is there a way to access a single instance of an object(singleton
    class) across different processes ?
    thanks
    curious.one
    curious_one Guest

  2. Similar Questions and Discussions

    1. Binding a single object to a control
      Hi all, This probably sounds like a stupid question, but what is generally the recommended way to display a business object in the aspx file for...
    2. double coordinates on a single object
      Hi All, i have to create a big floor with a tiled texture on it ( a museum floor) Then i have to create a big lightmap on this floor with the...
    3. HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP
      I have a seating chart web form that has over 50 entry field controls (tables/booths) where I use a DropDownList box to select a single company...
    4. Dependencies on single object files in a library
      Problem's as follows: I've got a static library libabc.a made of a.o, b.o and c.o, which in turn were created from a.h/.C, b.h/.C and c.h/.C,...
    5. Multiple object types in a single .pm?
      I have two very closely related classes that I'd like to implement in a single .pm. I realize that the usual setup is that if you're going to do...
  3. #2

    Default single object across processes

    Hi,
    Is there a way to access a single instance of an object(singleton
    class) across different processes ?
    thanks
    curious.one
    curious_one Guest

  4. #3

    Default Re: single object across processes

    curious_one wrote:
    > Hi,
    > Is there a way to access a single instance of an object(singleton
    > class) across different processes ?
    > thanks
    > curious.one
    cross posting to 4 groups is going to annoy some people.

    comp.lang.c++ answer : c++ has no knowledge of process. What your
    question got to do with the c++ language ?

    comp.unix.internals : what's an object ? what's a singleton ?

    comp.unix.programmer : no answer

    comp.unix.solaris : java has JVM's and you can't do anything a JVM can't
    do !


    So the true answer to your question is that if you want to share a
    singleton you need to allocate it in shared memory. Now you run into
    problems of address mapping. The object may be in a different address
    in different processes. Not only that, any virtual methods almost
    certainly will cause trouble since they won't be mapped to the same
    addresses either (if they exist at all).


    So far, your singleton is very limited in ability.

    So, if you're still interested because this is really what you need,
    then you may get some help from some mutex library.

    So there are some C++ template classes that could help (like a
    relocating smart pointer that relocates addresses dynamically) and a few
    others to deal with finding the right methods in a process.

    More than this is hard to specuate ...


    G

    Gianni Mariani Guest

  5. #4

    Default Re: single object across processes

    curious_one wrote:
    > Hi,
    > Is there a way to access a single instance of an object(singleton
    > class) across different processes ?
    > thanks
    > curious.one
    cross posting to 4 groups is going to annoy some people.

    comp.lang.c++ answer : c++ has no knowledge of process. What your
    question got to do with the c++ language ?

    comp.unix.internals : what's an object ? what's a singleton ?

    comp.unix.programmer : no answer

    comp.unix.solaris : java has JVM's and you can't do anything a JVM can't
    do !


    So the true answer to your question is that if you want to share a
    singleton you need to allocate it in shared memory. Now you run into
    problems of address mapping. The object may be in a different address
    in different processes. Not only that, any virtual methods almost
    certainly will cause trouble since they won't be mapped to the same
    addresses either (if they exist at all).


    So far, your singleton is very limited in ability.

    So, if you're still interested because this is really what you need,
    then you may get some help from some mutex library.

    So there are some C++ template classes that could help (like a
    relocating smart pointer that relocates addresses dynamically) and a few
    others to deal with finding the right methods in a process.

    More than this is hard to specuate ...


    G

    Gianni Mariani Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139