6 ms·
Every time I read about concurrency in other languages I see them trying to become Erlang but without the core design decisions that make Erlang works. Always
by brightball 10y ago
Every time I read about concurrency in other languages I see them trying to become Erlang but without the core design decisions that make Erlang works.
Always reminds me of this quote:
"Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang." - Robert Vriding
- pjmlp 10y agoThe problem is that Erlang is only good a network communication and parallel programming, which is of course to be expected, given the language design goals. The problem is when one tries to make a general purpose solution out of that design. For example, how would Erlang look like in GPGPU programming, video/audio codecs, graphics programming, GUI,...
- signa11 10y ago> The problem is when one tries to make a general purpose solution out of that design. yup. go(lang) / rust seems to be exploring some ideas with an almost similar approach, but not _solely_ focussed on n/w programming. are there other languages out there as well ? and a slightly open ended question as well: in your opinion, do you think a language needs to implement a complete runtime (similar to erlang) with it's own 'process' abstraction, scheduler, i/o etc. etc. to provide concurrency support ?
- pjmlp 10y agoWell, C++, D, .NET, Java, Swift, Objective-C, Rust... are all exploring the runtime approach for concurrency support. The main difference across those languages and Erlang/Go is how they expose the runtime to the developers. It isn't a black box, rather they exposes a default set of behaviors and as set of APIs that allow to fine tune its behaviors.
- signa11 10y ago> Well, C++, D, .NET, Java, Swift, Objective-C, Rust... are all exploring the runtime approach for concurrency support. wasn't it hans-boehm, who famously posited (?) that concurrency needs to be part of the language, rather than bolted on after the fact ? do you think that makes all these other languages kind of poorer w.r.t concurrency ? edit-001: specifically, this is the paper that i am talking about: http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf
- pjmlp 10y agoBut concurrency is part of the language. What you are missing is that those languages are quite expressive, thanks to generics, operator overloading, trailing lambdas, and APIs into runtime the are available as tools for the programmer. So you get, for example, async/await built into the language, with a default behavior. But at the same time, the necessary runtime hooks that allow any library writer to fine tune and built other concurrency models on top of it. For the user of those concurrency models, it is indistinguishable where they are coming from.
- brightball 10y agoThe disnguishing factor is prescheduling vs cooperative scheduling. In all those other languages each process has to hand control back to the scheduler - meaning runaway code can negatively impact everything, pause the entire stack to garbage collect and can't transparently distribute itself across machines because of shared memory (you can't transparently pass a pointer). Those are design decisions you can't bolt on later. Isolation, prescheduling and message passing without shared memory get you access to all of that.
- pjmlp 10y agoYes you can, has been done in Java, .NET, Active Oberon and Modula-3, just from the top of my head. It is only a matter of making use of the said compiler hooks and underlying machinery.
- zzzcpan 10y agoI believe erlang-style language level lightweight isolated processes is the only future. It will help not only with concurrency and distributed system, but also with security and reliability. For example, wild regexp that takes forever on some inputs will not affect other processes and won't bring the whole system down and a broken input validation will not help any client to cross the trust boundary of its process.
- di4na 10y agoGui is not that hard, there are couples of examples out there. After all it is just dealing with some binaries. For GPGPU, video/audio codecs and all ... You want single threaded things. And there Erlang says "i'm ok with that" and let you use Native Implemented Functions (NIFs) that enable you to use Rust, C and co. Or to use what is called a Port and let you interface with a program outside of erlang in a safe way. Works quite well. Then Erlang is used as a "concurrent and distributed glue" between your programs. There are a couple of scientific simulations that use erlang like that in the wild.
- zerofan 10y agoIs there some reason Erlang had to be slow for single threaded things? Mixed language programming isn't desirable for many of us. I suspect Erlang could be fast, with just a few changes, but it never will be.
- di4na 10y agoSome. 1) it was never seen as a problem because the erlang team believe (and i agree with them) that you best let specialists deal with their speciality are. 2) There were never an efficient JIT on the BEAM. This is something that is regularly looked at by the OTP team, but it would be a massive effort, just to try to approach effiency of what other language, that you can easily interact with, could do. 3) The use case are small. Let be honest. The amount of problems that are really only CPU bounded are limited in day to day work.
- zerofan 10y agoMy last project saturated a cluster of computers for days at a time. Not everyone writes crud screens for day to day work, honest. Parallelism is about performance, and it seems contradictory to do parallelism well on top of a slow language. Yes, Erlang can call out to other languages, but so can shell scripts.
- ramchip 10y ago
- zzzcpan 10y agoThe problem is in doing concurrency for the sake of doing concurrency. There is no general purpose solution for concurrency, because concurrency is not a problem to solve. You either need to scale and way beyond a bunch of cores you have on a single machine, so you go into distributed systems, or you don't need to scale, then you are fine with the single core, possibly with some primitive but safe abstractions for parallelism (not threads).
- Pxtl 10y agoSee Wings3D to find out.