Erlang processes in .NET

October 25, 2006

I’d like to implement Erlang in .NET as a high-level abstraction above the gritty threading library. The problem is that .NET threads must be larger than 128K, whereas Erlang processes are very small (maybe 300 bytes). Therefore, .NET can create 4000 threads on my little machine, compared to 30,000 Erlang processes. The alternative is to use the Threadpool library to handle all concurrency. Erlang uses message-passing to communicate between processes. In .NET I can implement send and receive as delegates that I put back in the threadpool, effectively implementing a yieldso other processes can run. It’s still cooperative multithreading, which has the standard problem that if a process goes berserk there’s no way to preempt it. As for the queues, these can be implemented to minimize synching and the messages are just pointers to objects, so that’s going to be very fast. If it works, it should be a more convenient API for concurrency than working with threads and monitors directly.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: