in reply to Re: Re: communication between forked processes
in thread communication between forked processes

Definitely no problem with UNIX.

For Perl, Perl only started to really support thread in 5.8.0. For the Perl part, there are some very useful information in perldoc, check out the threads, and threads::shared pragmas.

As for online material, go google, and search for pthread (do not search for thread), it will give you whole bunch of result, I just checked it. Really useful stuffs. Those are not about Perl’s thread, but as you never used thread before, understand POSIX thread will definitely help you, and Perl’s thread mimics POSIX thread a lot, at least at the interface and concept level, so this would also help you to understand Perl thread.

I am a little bit concerned whether it is good to use Perl to learn thread (considering it just started and a little bit prime). My path is I understood thread first, then came across Perl. Check whether you have pthread lib installed on your unix box, if yes, play it with c, while you are working on Perl at the same time. (if no pthread installed, there is always the native thread, but I would think that’s less ideal.)

There is a good book from O’Relly called “Pthreads programming”, not thick, good for both beginners and experienced programmers, and it has a section about why “shared memory” is a bad choice.

Update

You might also search my write-ups for the word “threads”, I have some quick examples there. As all those examples say “use threads”, this search should work.
  • Comment on Re: Re: Re: communication between forked processes

Replies are listed 'Best First'.
Re: Re: Re: Re: communication between forked processes
by snafu (Chaplain) on Feb 25, 2003 at 10:31 UTC
    This has been quite helpful...only, I'm curious now. It's been about a few months since I've installed 5.8. In fact, the machine that Chad (gnu@perl) is talkin about here is probably the one I installed it on.

    I distinctly remember reading during the installation that threads should still not be used because they are very experimental. Thus, since the machine that this Perl was being installed on is well, *very* important, I didn't put the option in to use threads. Now, I am not sure if this is the machine he is trying to use. So, the second part of that question is does threading have to be included during the install in order for Perl to do threading properly? If not, can real threading still be done? I believe there is a module you can still use (via the older method that you could use pre 5.8, right)?

    Thanks! This will clear up some questions I had in this area too.

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

      There is another place that provides useful information about Perl threads. Checkout the document for Thread module, it talks about a bit history, and more importantly, what you want to know about installation.

      I copy and paste a little piece of it:

      “Neither model is configured by default into Perl (except, as mentioned above, in Win32 ithreads are always available.) You can see your Perl's threading configuration by running perl -V and looking for the use...threads variables, or inside script by use Config; and testing for $Config{use5005threads} and $Config{useithreads}.”

      And made up a three-line to do what they said:
      use Config; print "use 5005 threads\n" if $Config{use5005threads}; print "use ithreads\n" if $Config{useithreads};


      Hope this helps.