Share objects between processes - how?

  • Thread starter patrik.xx.hoiem-flyckt
  • Start date
P

patrik.xx.hoiem-flyckt

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
 
B

Bastian Ballmann

Hi!

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
 
A

anno4000

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
 
P

patrik.xx.hoiem-flyckt

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top