http://qs1969.pair.com?node_id=1094204


in reply to The problem with "The Problem with Threads"

Thanks for writing your thoughts about threads. I use threads, and I like them a bit more than most of the other ways to introduce parallelism and concurrency. I only have one quibble with your points:

The "heaviness" of P5 threading is a misnomer. The threads aren't heavy; the implementation of shared memory is heavy. And that could easily be fixed.

As the current implementation of threads tries to simulate parallelism within one interpreter, "fixing" that is not easy as long as you want the promise of implicitly shared things (like the namespace and tied variables most importantly) to remain there. If you move to a less implicit model of sharing, like your usual approach using a queue, and also remove the promise of changes being visible to every thread, or convert it to a threat/warning that changes become visible everywhere, without protection, then I can concur that threads could become less heavy. But as they are now, they are heavy and making the Perl environment look to several threads as if they were the only thread currently running makes them remain heavy.