Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang on a JVM/CLR

Tags:

jvm

clr

erlang

I've just started reading Joe Armstrongs book on Erlang and listened to his excellent talk on Software Engineering Radio.

Its an interesting language/system and one whose time seems to have come around with the advent of multi-core machines.

My question is: what is there to stop it being ported to the JVM or CLR? I realise that both virtual machines aren't setup to run the lightweight processes that Erlang calls for - but couldn't these be simulated by threads? Could we see a lightweight or cutdown version of Erlang on a non Erlang VM?

like image 706
Fortyrunner Avatar asked Apr 20 '09 23:04

Fortyrunner


People also ask

Does Erlang run on JVM?

Oh, and there's even an Erlang implementation that runs on top of JVM: Erjang. It's capable of running Erlang programs, although it does have it's own quirks and differences, but it does work!

What is the beam and how is it different from the JVM?

Unlike the JVM, which maps its threads to OS threads and lets the operating system schedule them, the BEAM comes with its own scheduler. The scheduler starts, by default, an OS thread for every core and optimises the workload between them.


3 Answers

You could not use JVM/CLR libraries, given their reliance on mutable objects.

Erlang exception handling is quite different from JVM and CLR exceptions, you would need to handle this somehow.

Implementing processes as threads would mean that any sizable Erlang system runs out of memory pretty fast (process size on my machine on creation: 1268 bytes, thread stack size in CLR: 1 MB) and communication between processes is much slower than in Erlang.

What you probably want is an Actor Model implementation on JVM or CLR.

Scala and Clojure have already been mentioned. In addition, there are many Actor implementations for JVM: Kilim, Functional Java, Jetlang, Actors Guild, ActorFoundry, and at least one for CLR: Retlang, which can be used from any JVM/CLR language.

like image 118
Alexey Romanov Avatar answered Nov 11 '22 20:11

Alexey Romanov


For educational reasons, we are implementing a subset of ErlangVM for CLR. We were highly inspired by Kresten Krab Thorup and his project Erjang, a JVM based Erlang VM. Erjang uses kilim framework for representing lightweight processes, and it starts to attract attention.

Javalimit - Erjang's author blog.

Erjang repository

like image 29
topless Avatar answered Nov 11 '22 20:11

topless


This is a well trod-discussion. Some context might be useful.

From the Erlang mailing list last November:

  • The start of a long discussion thread

  • continuing here

  • and going a bit mental here

  • and ending on Joe's contribution.

My contribution to the debate about Erlang on the JVM? No, not a good idea :(

like image 7
Gordon Guthrie Avatar answered Nov 11 '22 21:11

Gordon Guthrie