Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Threading with a twist -- a panorama

by Discipulus (Canon)
on Oct 03, 2017 at 07:23 UTC ( [id://1200578]=note: print w/replies, xml ) Need Help??


in reply to Threading with a twist

Hello scorpion7 and welcome to the monastery and to the wonderful world of Perl!

you are asking for some guindance and I must admit I'm not able to provide it, but in the monastery you can find very good suggestions about this matter. Even if I'm not able to provide such guidance I can suggest you something because I'm following parallel perl programming since years, even if i produced almost nothing in this field.

First of all: is possible to produce full working perl parallel applications but the path is full of possible pitfalls. At some point perl threading was oficially discouraged because was too easy make it the wrong way (*).

But is definetively possible to produce good working code but you must take inspiration (read: copy) from the rigth authors. Here at perlmonks we have definetively at least two incredibly neat parallel perl programmers: BrowserUk and zentara.

While the first is more used to work on windows systems the latter almost exclusively works on Linux. Super Search their posts about parallel programming and you'll get a goldmine of neat and smart solutions and many insigths about possible pitfalls.

This does not means that no other monks here is a parallel programming expert, but the two above are eminent for offering full working examples (for example karlgoethebier's serie Threads From Hell is also very interesting).

Many links are present in my homenode about this matter, not only by the two monks above but also by others experimenting about parallel programming.

Then there is the framework: read my meditation parallel programming and MCE - hubris and the frame about it.

Infact a recently appeared monk, marioroy has produced a wonderful module suit to help building parallel applications with the full support for windows systems and many other goodies: MCE Many-Core Engine for Perl.

marioroy is very active and responsive here at perlmonks and you can read with profit all his posts here because all are about parallel programming and he offers many times complete examples and benchmarks between different approaches.

I hope the above is interesting for you and I hope you'll share your findings and progress.

L*

Note (*) I think my opinion about the possibility to do parallel programming in Perl seems to me clearly exposed in the present thread and in the linked one: however it also seems that to quote a, even if discutible, part of official documentation attracts critics as below expressed. I see no problem in what I said if examinated in the context. Anyone can think what they want.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Threading with a twist -- a panorama
by ikegami (Patriarch) on Oct 03, 2017 at 07:55 UTC

    some point perl threading was oficially discouraged because was too easy make it the wrong way.

    Bah, if you do it wrong --not reuse threads-- it's just going to be a bit slower. Yup, that's all there is to that warning. Just use a worker model and you're fine.

    Someone threw a tantrum when they wrong that warning, and it's poisoning the community.

      > Whoever wrote that warning is toxic!

      toxic or not is still in official docs

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        "... toxic...."

        This one, right?

        "The "interpreter-based threads" provided by Perl are not the fast, lightweight system for multitasking that one might expect or hope for. Threads are implemented in a way that make them easy to misuse. Few people know how to use them correctly or will be able to provide help."

        Ja, ja. The few enlightened and the many blockheads. Is multitasking only stuff for some self-appointed elite? No. This should be extinguished from the docs!

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

        Yes, we just covered that. The docs officially recommends against you using threads because you are too stupid to use threads. What kind of recommendation is that!? Of course threads are hard; that has nothing to do with Perl, and whatever alternative you're going to use instead isn't going to be any easier. And then you went and repeated this travesty.

        Threads is beautiful for many use cases. So are many parallel modules available on CPAN. Running parallel using Perl is amazing on today's multi-core processors, having 16 or more cores.
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re^2: Threading with a twist -- a panorama
by scorpion7 (Novice) on Oct 18, 2017 at 09:00 UTC
    Excellent info! Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1200578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-03-28 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found