Saturday, November 7, 2009

Parallel programming is easy

Pundits have been wringing their hands over the difficulty of parallel programming for several decades at this point. Every time a new processor with more cores is announced, I hear some new dire prediction about how we'll never be smart enough to program it. And they're right, it is hard. But we're not seeing huge challenges in building consumer and business applications that scale relatively easily.

Instead, the opposite seems to be happening in the real world. Databases, websites, CRM systems, etc process more and more requests per second using more and more processors, cores and servers. Yes, If I'm writing a complicated algorithm to simulate something or building my own database server then I have to think carefully about locking and synchronization. But luckily, very few people have to do that and those that do can afford to think long and hard about these problems.

Instead, most of what programmers do is write mostly sequential programs that happen to run concurrently with many copies of themselves, largely oblivious to each other. By and large, the software engineering world has developed a few basic abstractions (going back to IBM in 1969 with CICS) that make it actually quite easy to write parallel business-oriented programs.

It also turns out that most real world business applications have tons of data parallelism to them meaning they inherently require very little synchronization. For example, two web requests to render pages about books on Amazon really don't have to coordinate much at all. Roughly, they have to coordinate access to an integer representing inventory levels and coordinate with any backend updates happening to change titles, descriptions etc.
blog comments powered by Disqus