in reply to Methods for Asynchronous IPC

It can be clever to use Light Weigth Processes ( LWP ). LWP allow you to execute child processes in the same address space than their parents.
In order to make this, you have to use the clone() syscall.
This kind of processes can be called "Threads".
By the way, I don't know how perl implements neither the use of threads ( if it does ) nor the clone syscall.

I ask the monks : did perl allow multithreaded programmation ?

Update :

There is a module called "Thread" that provide you basis functions to implement a parallel processing and shared variables management ( Semaphores... ).
Main process share global vars with the childs. Each of it can thus freely store a report, and main thread can process it. You may also use signal IPC to inform main process of its child's state.

Hope this helps ( and I'm not too boring :)

Replies are listed 'Best First'.
Re (tilly) 2: Methods for Asynchronous IPC
by tilly (Archbishop) on Feb 02, 2001 at 21:40 UTC
    Perl's threading model is unstable, differs with every major release, and Perl 6 (which is projected to be stable) will undoubtably have yet another model. In short you don't really want to use it.

    Beyond that, the clone() call is very, very much Linux specific. Nobody else does things that way, and if you wish to write portable code in C you won't either.

    Besides which, threaded code is definitely a mixed blessing. There are definitely times when multi-threading is the right thing to do. But I get very wary when I see people pulling it out as an answer everywhere. See Threads vs Forking (Java vs Perl) for further discussion on why.

    Linking by ID seems to be broken at the moment. The missing thing to try for further discussion is Threads vs Forking (Java vs Perl)...

      Very interesting node.
      I see clearer now : thread is not in the "perl" spirit :)
      So I only discover perl and some old c uses reapers sometime !

      Thank's for this answer.

Re: Re: Methods for Asynchronous IPC
by arhuman (Vicar) on Feb 02, 2001 at 17:28 UTC

    As far as I know Thread support is still considered as experimental in Perl