5 ms·
Notably, with shared memory and atomics, pthreads support is on the horizon. https://kripken.github.io/emscripten-site/docs/porting/pthreads.html#running-code-
by ihsw2 9y ago
Notably, with shared memory and atomics, pthreads support is on the horizon.
https://kripken.github.io/emscripten-site/docs/porting/pthreads.html#running-code-and-tests https://kripken.github.io/emscripten-site/docs/porting/pthre...
Granted it may be limited to consumption via Emscripten, it is nevertheless now within the realm of possibility.
For this that cannot grok the gravity of this -- proper concurrent/parallel execution just got a lot closer for those targeting the browser.
- slackingoff2017 9y agoShhhh node people still pretend threads don't exist
- always_good 9y agoNot sure that anybody is "pretending" anything. Seems like you're just going out on a limb to be condescending.
- MuffinFlavored 9y agoI hope those kinds of comments do not start making their way towards HN. Reddit is getting so bad lately, an influx is probably due.
- olingern 9y agoHmm... can't tell if this is an attempted Node slam, but figured I would add that you can mimic threads / concurrent tasks by utilizing the child_process or cluster modules.
- ihsw2 9y agoAs a matter of fact, it certainly makes things a fair bit more pleasant than the current state of affairs as they -- shared array buffers -- are another data primitive on top of bidirectionally passing strings/buffers.
- judah 9y agoAre locks and mutable shared memory a good thing? Advances in modern programming languages aim to abstract threads away (e.g. .NET's Task Parallel Library), because mutable memory shared between threads is a minefield (atomic, locks, mutexes, compare-exchange, etc.). Not only are these difficult to reason about and program against, introducing locks over mutable memory causes performance problems and are a speed bump to high concurrency. (Heck, just yesterday on HN, a story was published "24-core CPU and I can't move my mouse" [0] - the culprit? Low-level locks.) Creating too many threads introduces performance problems, too, thanks to CPU context switching; pools must be created and threads reused from those pools. And now in JS land we're trying to introduce threads and mutable shared memory? Are we just going to learn these lessons over again? [0]: https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and-i-cant-move-my-mouse/ https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and...
- int_19h 9y agoTPL abstracts threads away, but not mutable shared memory, nor any primitives used to synchronize access to such from concurrent tasks.
- judah 9y agoTPL (and PLINQ) raise the level of abstraction. They discourage the use of mutable shared memory and low-level locks. They encourage the use of immutable or thread-safe data structures. Joe Duffy, who had originally done quite a bit of initial work on the TPL, argues in favor of this paradigm[0] of raising the abstraction level. I feel like introducing the low-level tools without providing a raised abstraction level may be beneficial in the long run (you need low-level tools to build high-level abstractions), however, without these abstractions I suspect a generation of JS developers will need to re-learn all the multi-threading lessons of the last few decades. [0]: http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/ http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/
- ihsw2 9y agoWe have the great benefit of stewards having already learned those lessons.