24 July 2007 12:30
PARLEY
by pvergainPARLEY is an API for writing Python programs that implement the Actor model of distributed systems, in which lightweight concurrent processes communicate through asynchronous message-passing. Actor systems typically are easier to write and debug than traditional concurrent programs that use locks and shared memory.
PARLEY can run using either traditional native threads, greenlets (lightweight threads), or Stackless Python's tasklets. A program written using PARLEY can choose between these models by changing a single line of code.
Usage
Messages in PARLEY can be arbitrary objects, but the standard message format is a 4-tuple: (tag, sender, args, kwargs). A typical way to handle such a message is to look up a function based on the tag; pass args and kwargs as parameters to the function (args being position parameters, and kwargs being keyword parameters); and to send the return value of the function as a message to the original sender.
You can check out the latest version from Subversion using the following command:
svn co http://artdent.homelinux.net/parley/trunk
1
(1 marks)