Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sample codes for multithreaded perl models

There is a tutorial about Perl threads here: However very little information is given about multithreaded program models: Boss/Workers, Work Crew, Pipeline. I have no ideas on how to implement these models.

Would yo be so kind to give me some example working codes on these?

Update:
Thanks Ojosilva for giving some links, I googled before asking this questions I came to two of them. The first example is old and not good. Two remaining ones are fine. But some more "real world" examples involving file input/output and shared access of variables will be great.

For example, I am a computer expert working for God who loves Perl. He has address books of countries in the world in tab-separated text files, Many of them would be several GBs. He want me to parse an arbitrary combinations of these text files (e.g. addressbook_usa.txt, addressbook_russia.txt , addressbook_india.txt) to do some statistics (e.g. about age, sex, distribution of the world). He want me to show him Perl's magic that get this work not only done but DONE FAST, because he does not want to waste his mighty multicore workstation with lot of RAM and disk space.

FYI I also looked at Thread::Pool and Thread::Pool::Simple modules on cpan. The former is quite promising, but I failed to installed on my workstation. The later is barely simple with no example codes. And again, my point is to find something to learn about how to implement of multithreading Perl, not just jump right at the top.

like image 912
biocyberman Avatar asked Feb 28 '11 16:02

biocyberman


1 Answers

Here's a Work Crew example

A Boss/Worker example can be found here

And a pipeline one

Not the best examples, but may get you started.

like image 176
ojosilva Avatar answered Oct 27 '22 19:10

ojosilva