News for hackers. Stuff that matters.
Re:Things you didn't know about multithreaded programming by lemming on Tuesday November 09, 2010 @09:40AM (#1886530)
See Kilim (http://www.malhar.net/sriram/kilim) for a lightweight thread solution for Java that easily outpaces Erlang for thread creation and message passing. It's the basis for the Erjang project which runs Erlang bytecode on the JVM. While it's faster at a low level, it obviously doesn't provide everything that Erlang does (supervisor hierarchies etc). It's still pretty impressive that this can be achieved on the JVM though.
Re:Things you didn't know about multithreaded programming by silentbicycle on Tuesday November 09, 2010 @11:03AM (#1886834)
Well, sure. Erlang processes aren't threads. They're more like pre-empted coroutines, with a scheduler that factors in when they're blocking and waiting to receive a message (among many other things).
Re:Things you didn't know about multithreaded programming by mzl on Tuesday November 09, 2010 @05:04PM (#1888128)
What would you say the essential difference is betwee pre-empted coroutines with a scheduler and threads?

The only thing I could think of is that with coroutines one can explicitly pass control over to another coroutine, but that is something that Erlang does not provide, so I don't really understand what you mean.

Re:Things you didn't know about multithreaded programming by silentbicycle on Tuesday November 09, 2010 @05:13PM (#1888155)
Erlang processes are managed by its scheduler, while threads are managed by the OS. Erlang has more info about appropriate stack sizes, garbage collection is done per-process* , it only pre-empts processes that are currently working or recently got a new message, and probably a half dozen other optimizations I'm not aware of. Let me know if you have more questions, I really like Erlang and I've wanted an excuse to research this. :)

* And often doesn't need to be done at all, because the process terminates first.

Re:Things you didn't know about multithreaded programming by mzl on Tuesday November 09, 2010 @05:06PM (#1888133)
Cool, I hadn't seen this before. I will definetly check it out. Thanks for the pointer.