Home > Articles > Open Source > Python

  • Print
  • + Share This
Like this article? We recommend

The Problem to Solve

The ability to create literally thousands of concurrent actions is immensely powerful. You could use it for all kinds of cool and useful applications, such as high-capacity web servers or FTP servers. Gordon McMillan's What is Stackless has a reference implementation of a microthreaded FTP server available.

However, to introduce a lighter note, I decided to write a small population simulator using Stackless. This simulator models the growth and decay of communities using a set of simple rules derived from the Aurea role-playing game. Every person in this simulation is a Python object running autonomously in its own thread; this is commonly called a software agent.

While far removed from the usual bread and butter "forms and databases" applications most of us have to work on, many enterprises require similar simulations. For instance, the Dutch equivalent of Disneyland, De Efteling, has commissioned a visitor simulator to determine effective queue management strategies. The company I work for, Tryllian, produces a powerful platform for these kinds of simulations, the Agent Development Kit (ADK). This is written in Java and contains a custom scheduler that effectively offers the same kind of scalability as Stackless Python—but for Java.

Another area in which Stackless Python has already proven its worth is in gaming. Most popular games nowadays feature a large host of independent, computer-generated "characters"—again, a natural solution is to employ the agent paradigm, in which every computer character is one agent, running in its own microthread. The game EVE: The Second Genesis, for instance, is using Stackless Python for this purpose.

  • + Share This
  • 🔖 Save To Your Account