Share objects between processes - how?

Discussion in 'Perl Misc' started by patrik.xx.hoiem-flyckt@ericsson.com, Apr 20, 2007.

  1. Guest

    Hi,

    I have a problem that you might help me with. I have a client app made
    in perl/tk that speaks with a server (RPC::plServer, built on
    Net::Daemon). This server forks a process per product type (PT). You
    can run different perl scripts for each PT (to test the PT). Since
    RPC::plClient makes synchronous calls, I want to either thread or fork
    a process while running scripts for the PTs, since the scripts can
    take several hours to run. Otherwise the client will get locked during
    this time. I have tried a threaded solution and a forked solution and
    they work fine as long as I don't have to share anything. But I have a
    session object, containing session variables that I have to get back
    from the child process after it's finished. I've tried threads::shared
    (I get: LogHandler not of correct type or something like that) with no
    success and IPC::Shareable in the forked solution with no success ( I
    get: Could not create semaphore set: No space left on device). Is
    there any good documentation about these different solutions out
    there? Can someone point me (to anything else than the CPAN info)?
    Well I've searched the net and haven't found anything that has shed
    light on this. Well I've read something about the semaphore fault...

    If you need more info don't hesitate to ask me. I'm on Solaris by the
    way.

    Regards
     
    , Apr 20, 2007
    #1
    1. Advertising

  2. Hi!

    schrieb:
    > Is
    > there any good documentation about these different solutions out
    > there? Can someone point me (to anything else than the CPAN info)?
    > Well I've searched the net and haven't found anything that has shed
    > light on this. Well I've read something about the semaphore fault...
    >


    I dont know a documentation about the different solutions, but i've
    used two different ones to solve that kind of problem.

    Try to use SOAP or serialize your objects with Storable and pump them
    over the pipe.

    HTH

    Basti
     
    Bastian Ballmann, Apr 20, 2007
    #2
    1. Advertising

  3. -berlin.de Guest

    <> wrote in comp.lang.perl.misc:
    > Hi,
    >
    > I have a problem that you might help me with. I have a client app made
    > in perl/tk that speaks with a server (RPC::plServer, built on
    > Net::Daemon). This server forks a process per product type (PT). You
    > can run different perl scripts for each PT (to test the PT). Since
    > RPC::plClient makes synchronous calls, I want to either thread or fork
    > a process while running scripts for the PTs, since the scripts can
    > take several hours to run. Otherwise the client will get locked during
    > this time. I have tried a threaded solution and a forked solution and
    > they work fine as long as I don't have to share anything. But I have a
    > session object, containing session variables that I have to get back
    > from the child process after it's finished.


    Is the session object actually *shared* between processes (or threads)?
    I mean, do processes access the object concurrently?

    If the session object belongs to only one process at any time you can
    pass it back and forth using standard serialization methods (Storable,
    Data::Dumper, alternatives on CPAN) without actually sharing it.

    Anno
     
    -berlin.de, Apr 20, 2007
    #3
  4. Guest

    On 20 Apr, 10:48, -berlin.de wrote:
    > <> wrote in comp.lang.perl.misc:
    >
    > > Hi,

    >
    > > I have a problem that you might help me with. I have a client app made
    > > in perl/tk that speaks with a server (RPC::plServer, built on
    > > Net::Daemon). This server forks a process per product type (PT). You
    > > can run different perl scripts for each PT (to test the PT). Since
    > > RPC::plClient makes synchronous calls, I want to either thread or fork
    > > a process while running scripts for the PTs, since the scripts can
    > > take several hours to run. Otherwise the client will get locked during
    > > this time. I have tried a threaded solution and a forked solution and
    > > they work fine as long as I don't have to share anything. But I have a
    > > session object, containing session variables that I have to get back
    > > from the child process after it's finished.

    >
    > Is the session object actually *shared* between processes (or threads)?
    > I mean, do processes access the object concurrently?
    >


    The session object today isn't actually shared, but it would be nice
    to be able to work with other stuff regarding a PT during the time
    that scripts are running - it is just a question about what
    limitations I have to set for the app. It could work with Storable
    maybe, at least for starters. The ultimate would be a real shared
    scenario though. I think it is weak by a language that claims to be
    object oriented not to support this in a natural way. Unfortunately
    the language isn't my choice. Then it would have been Java... Thanks
    anyway!

    > If the session object belongs to only one process at any time you can
    > pass it back and forth using standard serialization methods (Storable,
    > Data::Dumper, alternatives on CPAN) without actually sharing it.
    >
    > Anno
     
    , Apr 20, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Rodriguez
    Replies:
    23
    Views:
    1,212
    David Schwartz
    Dec 9, 2003
  2. ET
    Replies:
    6
    Views:
    277
  3. blumenkraft

    share dictionary between processes

    blumenkraft, Dec 18, 2009, in forum: Python
    Replies:
    7
    Views:
    453
    Steve Holden
    Dec 18, 2009
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,428
    Saraswati lakki
    Jan 6, 2012
  5. Replies:
    3
    Views:
    304
Loading...

Share This Page