Erlang-style Concurrency For Other Languages
What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)?
Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.
Answer
Message Passing Interface (MPI) (http://www-unix.mcs.anl.gov/mpi/) is a highly scalable and robust library for parallel programming, geared original towards C but now available in several flavors http://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations. While the library doesn't introduce new syntax, it provides a communication protocol to orchestrate the sharing of data between routines which are parallelizable.
Traditionally, it is used in large cluster computing rather than on a single system for concurrency, although multi-core systems can certainly take advantage of this library.
Another interesting solution to the problem of parallel programming is OpenMP, which is an attempt to provide a portable extension on various platforms to provide hints to the compiler about what sections of code are easily parallelizable.
For example (http://en.wikipedia.org/wiki/OpenMP#Work-sharing_constructs):
#define N 100000
int main(int argc, char *argv[])
{
int i, a[N];
#pragma omp parallel for
for (i=0;i<N;i++)
a[i]= 2*i;
return 0;
}
There are advantages and disadvantages to both, of course, but the former has proven to be extremely successful in academia and other heavy scientific computing applications. YMMV.
Related Questions
- → Sending multiple POST requests to the same session using threading
- → How do I say Laravel that if thread belongs to this user, alow him to
- → trying to get property of non-object - Laravel?
- → Interrupt driven vs Event Driven I/O model
- → How to use MessageQueue feature of appserver.io inside existing laravel project
- → Basic Python Threading Behavior
- → Can't connect to MySQL server on 'localhost' (111)
- → Associating DB connections with threads of Netty 4 event executor
- → Is Python multiprocessing.Queue thread safe?
- → Python: properly terminate worker threads
- → Python threads not executing properly on function call (Kivy)
- → GoogleApiClient: "Result has already been consumed" in multi-thread Android app
- → loopers in java vs thread without looper, and correct way to stop looper?