The Concurrency Explorer

The Concurrency Explorer (ConcX) is the reference implementation for the concepts identified and described in the Avian Computing Project. The essence of Avian Computing  is to model parallel programs as flocks of birds, where each bird in the flock behaves like a natural bird. ConcX supports this model by allowing users to create flocks of one or more birds, where each bird is actually an independent thread. The success (or failure) of each bird can be observed in real-time while the flock is flying or analyzed post mortem from timestamped histories.

All birds follow this basic life cycle

Once a bird has been started (hatched), it lives according to the standard bird life cycle: it looks for food, digests it if it finds it, stores any results, and then takes a nap. If the bird has been configured to reproduce, it will clone itself any time it has met its own requirements. If the bird is unable to eat for its specified length of time, it will die of starvation (unless otherwise specified). Each bird will die of old age when it has exceeded its configured length of time (unless otherwise specified). By describing a thread’s lifecycle in terms of a bird’s natural lifecycle, it becomes much easier to think about and manage threads.

All of these lifecycle behaviors have been coded into ConcX. To make it easier to think about and manage parallel programs, ConcX has been implemented as a GUI environment. The GUI environment makes it easy access to each bird’s individual configuration settings (life length, time to starvation, nap length, etc.). The GUI also provides activity progress bars for each bird that are updated in real time so it is easy to spot when a bird is behaving strangely, such as eating too much or not eating enough.

A flock of 20+ birds in flight. Each bird (thread) is assigned its own progress bar that is updated in real-time each time the bird eats.

Launching multiple threads is of little use unless data can be safely passed/shared. ConcX accomplishes thread-safe data sharing by using a TupleTree, which was borrowed from the concept of a tuplespace, an idea originally developed for the Linda coordination language. A tuplespace is shared associative memory used as a repository for tuples of data. Linda was originated in 1986 by Sudhir Ahuja, David Gelernter, Nicholas Carriero and others. Linda was the foundation for several major products, including Sun’s JavaSpaces, IBM’s TSpaces, and many more projects in a variety of languages.

In ConcX, when a bird successfully gets a food pod from the TupleTree, that bird has exclusive access to that food pod. The bird can do anything desired to that food pod without worrying about any other bird trying to modify it because it has the one and only reference to that object. None of the other birds knows anything about that food pod; instead they are each looking for their own types of food pods.

Each food pod in the TupleTree maintains a timestamped history of its events and which bird caused the event.

The TupleTree works with the standard bird lifecycle to simplify development of parallel programs because there is no need for developers to write any mutexes or lock any objects. ConcX handles all of cruft of parallel programs so developers don’t have to.

The screenshot above shows the timestamped event log of each food pod currently in the TupleTree. Reviewing the timestamps can provide useful information, such as if the food pod was used steadily or if there were large gaps in between times it was used. The timestamps can also demonstrate that multiple threads were processing multiple objects concurrently.

Additionally, each bird maintains its own timestamped log that records the events in its own personal history. Since all birds retrieve their time from the shared system clock, the times are consistent, allowing users to correlate what each bird was doing when any food pod recorded any event. This is especially useful when trying to understand why a food pod was incorrectly processed. The accompanying screenshot begins with that bird’s important configuration settings followed by the bird repeatedly looking for food, not finding any food and then taking a nap. The level of information collected can be configured for each individual bird and if this doesn’t provide enough diagnostic information, the source code for any bird can be modified to provide any desired information.

ConcX provides dozens of pre-programmed birds that can be individually selected and configured in the GUI. Flocks of birds can also be loaded from a file to make it quick and easy to get a lot of birds up and flying. The Getting Started guide describes the various parallel scenarios for which the pre-programmed birds were developed, as well as ideas of how to modify the configurations to change the scenarios.

Users can also create their own custom birds to meet the specific requirements of their parallel project. Custom birds typically only require overriding of a few “hook” methods in the BasicBird code. For example, if you wanted to add a bird’s name to the description of any food pod that it ate, custom bird would extend from BasicBird and then only have to override the afterEating method; all of the other functionality (finding food, storing food, starving, napping, etc.) would all be inherited from BasicBird.

Download ConcX and give it a try.