No, yes, no, they are indeed implemented differently. But that isn't my point. Threads and forks existed long before Perl's implementation of them and it is a mistake to confuse implementation with concept. You can use a facility to achieve something but that doesn't mean you should. Nor is the implementation of a facility a description of the problem it best solves. If you look at the documentation on
threads you will see that there is a very clear warning against their use. I believe that taking the underlying concepts into account is helpful in avoiding the use of threads in a manner contrary to the intentions, the problem Perl threads was designed to solve. That problem and therefore best-practice can best be understood from the pre-existing concepts, rather than how Perl later implemented its solutions for these concepts.
Update: Perl was first and/or most thoroughly implemented on unix which only supports fork in its underlying architecture. So Perl boldly went and implemented (interpreter-based) threads (i.e. without OS support), perhaps because they are supported in certain legacy operating systems such as VMS, RSX, RT-11, MVS etc. that were still contenders at that time. The great Unix and open source battle against proprietary architectures didn't get won until the mid 90s and the challenge is still available to us to produce a robust Perl implementation of the threads concept, unless someone can/will dig into the existing implementation more thoroughly and if their encounter is favourable, update the docs with a clear enough description of when it should or should not be used.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.