Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Share objects between processes - how?

Reply
Thread Tools

Share objects between processes - how?

 
 
patrik.xx.hoiem-flyckt@ericsson.com
Guest
Posts: n/a
 
      04-20-2007
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:lServer, built on
Net:aemon). This server forks a process per product type (PT). You
can run different perl scripts for each PT (to test the PT). Since
RPC:lClient 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

 
Reply With Quote
 
 
 
 
Bastian Ballmann
Guest
Posts: n/a
 
      04-20-2007
Hi!

patrik.xx.hoiem- 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
 
Reply With Quote
 
 
 
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      04-20-2007
<patrik.xx.hoiem-> 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:lServer, built on
> Net:aemon). This server forks a process per product type (PT). You
> can run different perl scripts for each PT (to test the PT). Since
> RPC:lClient 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:umper, alternatives on CPAN) without actually sharing it.

Anno
 
Reply With Quote
 
patrik.xx.hoiem-flyckt@ericsson.com
Guest
Posts: n/a
 
      04-20-2007
On 20 Apr, 10:48, anno4...@radom.zrz.tu-berlin.de wrote:
> <patrik.xx.hoiem-fly...@ericsson.com> 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:lServer, built on
> > Net:aemon). This server forks a process per product type (PT). You
> > can run different perl scripts for each PT (to test the PT). Since
> > RPC:lClient 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:umper, alternatives on CPAN) without actually sharing it.
>
> Anno



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
share dictionary between processes blumenkraft Python 7 12-18-2009 05:27 PM
Controlling processes and what to "feed" other processes Marc Heiler Ruby 1 05-24-2009 05:37 PM
Re: Sharing objects between processes ET Python 6 03-09-2009 11:48 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM



Advertisments
 



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