Jump to content

Page navigation

Content

Erlang style processes for Python

The Candygram modules has just been announced on comp.lang.python

I have read the thesis introducing Erlang and I think this a very interesting approach. But instead of switching to yet another language, I was wondering, if this mechanism could be implemented in my favourite language Python. I didn't do more than wondering yet, but now someone else tried an implementation. I'll definitly have a closer look at it.

A brief look into the source revealed that "Processes" are implemented using threads. One of the benefits of Erlangs approach is that processes are completly isolated and can only communicate via messages. Even malicious code in one process cannot corrupt another process. As far as I know this cannot be implemented in Python, if the processes run as thread in the same interpreter instance.

To achieve similar security, processes (a la Erlang) have to be implemented as real processes (as provided by the OS). This implicates that message passing has to use IPC. Once this is implemented, you'll get the possibility to distribute processes on a network as a free bonus. Or wait for a version of Python that provides secure isolation inside one interpreter.

Another thing is the existance of a processes() function that returns a list of all running processes. In Erlang access control is implemented in a "Capability based Security" style: Once you know about a process (have a reference to it), you can send messages to it. But if you don't have reference, there is not way you can access any data or services provided by it. processes() gives capabilities to all processes to everyone who asks… not good.

So at the moment Candygram provides the style of Erlang programming for Python, but not the most important advantages of this style. But it is still a promising beginning.

You are reading the (archived) weblog of Benjamin Niemann. This weblog has been closed, no new articles will be posted here.
If you can read german, you may have a look at my new weblog.

Navigation:

Archive:

Small print