Threading, Responsive UIs and the End of the Free Lunch
[...Or Deciding Between Synchronous and Asynchronous Programming Models]
There was a time when software developers had to spend many hours optimising their code - minimizing memory footprint and trying to squeeze every last ounce of performance out of the available hardware. That skill has almost died out now as we developers have come to rely on Moore’s Law and the assumption that by the time your project ships CPU performance will have improved enough so that it pretty much didn’t matter whether you spent any time doing optimization or not. But that could all be about to change…
For the last 18 months or so CPU clock speeds have hardly changed. Chip manufacturers are increasingly looking to other approaches to improve CPU performance. Herb Sutter recently wrote an excellent article (The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software) explaining some of the issues involved and the impact this will have on our lives as software developers: No longer will we be able to catch a free ride on the coat tails of ever-increasing clock speeds. Instead we will need to think about designing our applications to make use of these new architectures. One of the arguments Herb makes is that we will need to think much more about developing applications using asynchronous programming techniques. With that in mind Matthew Adams has an excellent set to guidelines about deciding when to choose a synchronous programming model vs. an asynchronous one. Matthew’s discussion has a particular smart-client slant to it and I highly recommend both these articles if you are interested in smart client design and development or threading issues in general.