开发者

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 Pe开发者_如何学Gorl. 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.


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.


It's a big code base, but for a more complex real-world example: Padre (the IDE) has a fairly complex worker pooling setup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜