develooper Front page | perl.perl5.porters | Postings from March 2014

Re: RFC: add discouragement warning to perl threads documentation

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
March 2, 2014 11:16
Subject:
Re: RFC: add discouragement warning to perl threads documentation
Message ID:
87B2A0E5-99AA-4B6E-9C8B-32A9910BFD90@dijkmat.nl
On 02 Mar 2014, at 07:09, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> * Christian Walde <walde.christian@gmail.com> [2014-03-01 21:50]:
>> Feel free to bikeshed or merge. :)
> After clarification on IRC about the contentious item I believe you
> wanted to say something like this:
> 
>  * complex data structures are hard to share properly
> 
>    Variables shared between threads needs to be flagged, but there is
>    no way to mark complex data structures as shared at once. So it is
>    easy to fail to share them completely, which results in hard-to-find
>    bugs and exceptions.

+1 from me.

Additionally, maybe it would be an idea to mention the forks.pm module on CPAN as an alternative on non-Windows systems?  It provides an almost identical threads API (last time I checked), without the disadvantage of the copying needed to start a thread.  Since forks.pm uses fork() to start a new thread, it uses the OS’s COW system to copying things only when needed.  This results in faster thread starts and lower memory consumption.  At the expense of slower inter-thread communication (such as updating shared variables).



Liz
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About