Concurrent programming with F# agents in London

If you live anywhere near London and are interested in F#, then you probably already follow the F#unctional Londoners group started by Carolyn Miller and Phil Trelford. I gave a talk at the user group in June about Reactive programming in F# (if you missed that, you can view the recording). I really enjoyed talking to an audience where most of the people already played with F#, so when I met with Phil recently, I couldn't resist offering another presentation.

My next talk will be about Concurrent programming with Agents using the MailboxProcessor type. A part of the talk will be inspired by my recent blog series about parallel programming, but I just finished another pretty cool example, so you should come even if you read my blog! This time, we'll have two talks, so you can also look forward to Phil Trelford's Behaviour Driven Development with TickSpec (you just cannot miss his debugging demo!).

When, what & where?

Last time, I brought a copy of my Real-World Functional Programming as a giveaway and I think I still have a few copies lying around...

Talk teaser: F# agents

F# agents (the MailboxProcessor type) are an implementation of message passing concurrency. This is a very attractive alternative to shared memory or even standard task-based or data-parallel concurrency models. It makes it easy to write reactive applications that receive inputs from various sources in parallel (e.g. user interface, network, background tasks etc.) Agents communicate by sending (immutable) messages to each other, which makes the application easy to understand. If you design the application correctly (and structure it using enough agents) it can be also very scalable. Among other things, I'll show the following examples:

  • Agent-based chat - A simple example to introduce agents will be a chat room that uses agent to store the state of a chat. You'll see that an asynchronous and concurrent application can be written quite easily with F#. You'll also see how to expose this service using a few lines of beautiful F# code inspired by Node.js.
  • Reusable agents, buffering and blocking - We'll also look at a few agents that are not directly bound to any application and you can use them to implement common communication patterns. If you have a few agents like this, you can easily put together a sophisticated application just by composing existing agents.

Published: November 23, 2010 04:40
Tags: Presentations

Share:


Send comments to this article

Comments for this article have been disabled. You are welcome to send additional comments using email.