Kamaelia: Pragmatic Concurrency, A tutorial

This was a tutorial held at Europython '09 in Birmingham on the morning of Sunday 28 June


 
 
 
 


Why use concurrency?

Since concurrency is viewed as an advanced topic by many developers, this question is often overlooked. However, many real world systems, including transportation, companies, electronics and Unix systems are highly concurrent and accessible by the majority of people. So, one motivation can be "many hands make light work".

However, with software this maxim often appears to be false - in no small part due to the tools we use to create concurrent systems. Despite this, the need for concurrency often creeps into many systems - even something as basic as "attaching a debugger".

Kamaelia is a toolset and mindset aimed at assisting in structuring your code such that you can focus on the problem you want to solve, but in a way that results in naturally reusable code that happens to be concurrent.
This tutorial aims to introduce you to the follow 4 core aspects of Kamaelia systems:

Axon
All Kamaelia systems are dependent on this core library - it provides you with tools for making systems which are naturally concurrent. Its primary metaphor is components with inboxes and outboxes, which get linked by parent components.
Kamaelia Components
The bulk of Kamaelia is actually a large collection of components. By themselves each component is useful, but their real power comes from being linked to each other, like programs in /usr/bin get linked together, forming pipelines.
Applications
This is the point of Kamaelia - to build useful systems. Kamaelia was originally designed for naturally concurrent problems, so there was a desire to make this simple(r) to work with. Using Axon based components means applications generate more reusable components, and also have a naturally concurrent structure. This can simplify many applications, allowing their reuse in unexpected ways.
Testing & Debugging
Testing & debugging concurrent systems is considered hard, we'll cover some approaches we can use in Kamaelia for debugging systems. Some of these are surprisingly familiar. Indeed, some can be used in non-Kamaelia based systems.
Kamaelia was designed originally to make maintenance of highly concurrent network systems simpler, but has general application in a wider variety of problem domains, including desktop applications, web backend systems (eg video transcode & SMS services), through to tools for teaching a child to read and write.

More Information

The rest of this website obviously contains more information, and based on lots of feedback, it does need work, but please do tell us how you think it needs work.

Also, a number of presentations have been made in the past. You can find these Kamaelia presentations on slideshare.

Notes

The notes are available in 3 forms:

  • One is PDF suitable for printing on A4 paper.
  • The other 2 ways are via lulu.com, which is a paid for print on demand service.
    • One is as a PDF download from lulu.com - this is set to a cost of zero, but isn't A4 paper. If you prefer screen reading rather than printing, this is probably the nicest one for that.
    • The other is as a printed book from lulu.com - this is basically at production cost (£1.89), meaning it's cheap, but beware of two points:
      • Postage from lulu.com can sting - but they appear to charge a flat fee whether it's 1 copy or 50 copies. (hence why I used them...)
      • Currently I'm going through it for typoes!
      • I do also still have some spares of the paper copies

The slides used in the tutorial are available on slideshare. As you might expect, different media have different benefits, and so each way of explaining things covers the same things in slightly different ways, but following a common theme.

Videos will go up on blip.tv, and are currently being transcoded.

Two relevant downloads are also available:

  • Kamaelia 0.9.8.0 - is the latest monthly release. These were started just before the conference, and we used 0.9.6.0 there. 0.9.8.0 also includes the changes/apps inside the Europython09 release. A number of minor issues with the 0.9.6.0 release have been resolved in this release, along with a fair number of merges of kamaelia based apps. (enable reuse of applications as well as components)

  • The Europython '09 specific release - this packages up all the example programs and scripts used in the tutorial.

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)