Erlang "processes" and Erlang "threads" are entirely different beasts. Indeed, there is no such concept as an Erlang thread as such.
Heh. That's funny.
Thanks for the history "lesson". No surprises there (nor anything that contradicts what I said).
Yeah, passing messages often copies data. If a data structure were a process, then passing a message might be considered like fork()ing. But a data structure isn't a process and Erlang's copying of data is very much not like fork()ing.
One thread per core. Queue(s) to facilitate communications. The absence of direct access to shared state. Internal locking.
Does that sound anything like the iThreads model I've been taking about?
"One thread per core" is certainly possible with iThreads. Nothing in iThreads says "use one per core", except, of course, the significant overhead (indeed, if doing I/O-bound operations using iThreads instead of non-blocking I/O, you probably need to "fiddle" with the number of threads to use in order to not be sitting idle too much while also not wasting way too many resources creating extra threads).
I don't believe "Queue(s) to facilitate communications" has even come up so far in this conversation. I don't believe iThreads uses queues. You can certainly use threads::queue with iThreads, of course.
"The absence of direct access to shared state" is done via quite different means, of course, between Erland and iThreads.
"Internal locking" is done by threads::shared and not much by iTheads itself.
Threading in Erlang is quite different from threading in C.
No, somebody told me Erlang doesn't have threads.
Why should threading in Perl have to be the same?
What strawman made that demand? But then, when I mentioned 'Erland "threads"' even using scare quotes, you chided me that they aren't "threads" so I guess you are making the demand that they can't be called "threads", presumably because they aren't like C threads.
In sum, Erlang threading (as I noted) isn't much like C threads, to the point that people don't usually call them "threads" (without qualifiers), and isn't much like fork().
Meanwhile, iThreads are also not much like C threads and calling them just "threads" has lead to them being misunderstood resulting in some significant resistance to their use.
And iThreads don't use internal locking nor queues. Threading was bolted onto the side of Perl after Perl had existed for many years. Attempts to use internal locking proved hopelessly unstable.
So they went a different route and avoided the whole "shared" route and instead emulated fork() by wholesale copying all state information and user data at "thread" creation time so each instance has a separate copy and no locking is required. Of course, they couldn't emulate fork() even close to as efficiently as a real fork().
Then they provided an add-on that ties variables so that each time you read a threads::shared variable a lock is held while the shared value is copied over to the particular instance. And they provided an add-on that implements a queue that can be used across instances.
And doesn't the above, (or the pdf if you bothered) sound a lot like the very type of thread-pool + queues mechanism I (amongst other) have been advocating here for years?
I don't know. I guess I haven't really been paying that much attention to you. I've noticed you post a lot of code that uses threads over the years. I don't recall having read a description of what you were doing. Code tends to have a ton of necessary details and, lacking a guiding description, I never noticed a particular pattern to your many code samples.
In any case, I was not aware of you having advocated some particular "mechanism". Did you think I was criticizing your mechanism? Is that why you've been acting so?
I'd suggest that we might be singing from the same song sheet
No, I'm clearly just playing political games, solely trying to scare people. You can tell that my arguments are simply FUD because, being political arguments, I'm prone to posting them as root nodes in non-SoPW sections so that the impact of the propaganda isn't diluted and because I use scary words like "monster".
- tye
In reply to Re^16: Erlang--the facts! (more)
by tye
in thread is ||= threadsafe?
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |