Programming with feedback

Feedback is an elegant and effective way to control complex, dynamic processes.

Everyone knows what feedback is. It’s when sound systems suddenly make loud, painful screeching sounds. And that answer is correct, at least partly.

Control theory, the study and application of feedback, is a discipline with a long history. If you’ve studied electrical or mechanical engineering, you’ve probably confronted it. Although there’s an impressive and daunting body of mathematics behind control theory, the basic idea is simple. Whenever you have a varying signal, you can use feedback to control the signal, giving you a consistent output. Screaming amps at a concert are nothing but a special case in which things have gone wrong.

We use control theory all the time, without even thinking about it. We couldn’t walk if it weren’t for our body’s instinctive use of feedback; upsetting that feedback system (for example, by spinning to become dizzy) makes you fall. When you’re driving a car, you ease off the accelerator when it’s going too fast. You press the accelerator when it’s going too slow. If you undercorrect, you’ll end up going too fast (or stopping); if you overcorrect, you’ll end up jerking forward, slamming on the brakes, then jerking forward again — possibly with disastrous consequences. Cruise control is nothing more than a robotic implementation of the same feedback loop.

A few months ago, Philipp Janert and I wondered why control theory is almost never used by software developers. There are a few exceptions, mostly in embedded systems (for example, cruise control). The answer may be simple enough: these days, relatively few software developers come through the ranks as electrical or mechanical engineers, and haven’t had exposure to the theory. But that isn’t a very good answer, even if it’s correct. In his work, Philipp has found control theory useful in applications as different as ad placement and supply chain management. And we’re willing to bet that, given the exposure, other programmers will find control theory a valuable tool.

Why? Software developers have been trying to build adaptive systems for years. We have lots of ideas about collecting data, analyzing it, and building models of how those systems behave. The problem with those models is that they’re prescriptive. They might tell you the optimal speed to travel to get from point A to point B, but they can’t make real-time adjustments to maintain your speed in response to actual conditions. In contrast, feedback systems are all about responding to actual conditions (and not about optimization). Modern software systems need to react to real-world conditions, such as radical variations in load; they can allocate more processors, memory, storage, and even network connectivity in response to changing conditions. For software to react intelligently and without constant human intervention, feedback isn’t an option; it’s a necessity.

Feedback Control for Computer Systems invites software developers to explore the uses of feedback. We ultimately don’t know why software developers haven’t discovered feedback. But now there’s no excuse: it’s an elegant and effective way to control complex, dynamic processes, and an important tool for anyone interacting with the real world.

tags: ,