Monday, February 20, 2006

Multi-core problems for all

One element of service architectures, paticularly when dealing with asychronous processing and multiple requests, that has been a common challenge has been coping with the issues of concurrency. Now with the rise of multi-core this wonder is open to all, and with it the challenges. For anyone doing Java there is of course the Doug Lea book Concurrent Programming in Java, which is a must for anyone trying out multi-threaded code. The problem is that multi-threaded code is hard, not just difficult its actually hard and many of the problems only occur when you get an increased level of concurrency, and sometimes only when you get truly concurrent execution. Multi-core enables this problem to be found by all.

First of all lets think of the challenge, right now dual core has become normal. Next year it will be quad core, so assuming your application has a 7 year life expectancy (at least) this means 2013, by which time the "normal" will probably be 32 core. This means that process engines that don't handle asychronous processing well are going to have scalability issues in the future as doing multiple tasks at the same time and then collating the results is going to be a much more effective approach than simple straight through processing.

Having 32 cores (although with scheduling the OS will probably see 4 times as many) means that when planning the desktop applications in your enterprise architecture you'll have to think about multi-threading in applications that have historically been single threaded, or at least assumed there was only one processor.

As a final attempt to put into perspective how much of a challenge this is for companies. Microsoft's current top line operating system is Windows Server DataCenter edition 64bit this has a maximum of 64 processor support. So in our 2013 world this won't run on a laptop which with 32 cores each reporting 4 threads needs 128 way support in the OS. This flagship OS has a fairly frightening shelf-life in a multi-core world (assuming 4 threads per core (ala Sun) becomes standard by 2009):
  1. 2013 won't run on a 1-way box
  2. 2011 maxed on a 1-way box, won't run on a 2-way
  3. 2009 maxed on a 2-way box, won't run on a 4-way
  4. 2007 (2 threads) maxed on an 8-way

I'm guessing that Vista will be addressing this, and I also hope they'll be upgrading their concurrency support in the .NET languages.

But simply put, having 128 way laptops is something that is liable to happen in the next ten years, and if all of your code whether in a J2EE container or on a desktop application isn't designed to take advantage of it you'll effectively be running single core code and wasting 127 processors.

3 comments:

Anonymous said...

Yep, ACM's Queue talked about this stuff a couple of issues back. It should be online by now, might be worth checking out.

Couple of links which might be interesting:

http://bc.tech.coop/blog/060105.html

and

http://bc.tech.coop/blog/060111.html

And no, I'm not proposing Lisp to be the concurrency solution :)

Anonymous said...

I should also have mentioned that the introduction of "ubiquitous concurrency" is a nightmare from a debugging/testing perspective.

I learnt a long time ago that if you're implementing multi-threaded systems it pays to have SMP hardware on your desktop because it tends to better provoke the deadlocks and race conditions that will occur.

And if you can't have the hardware on your desktop you want access to it remotely. Even then, deadlocks and race conditions will escape out to the field.

Deadlocks, at least in a JVM, can be isolated with a thread dump (so long as you can get the dump and process the results which may contain a couple of hundred plus threads).

The same cannot be said of race conditions, they can be difficult to replicate and tougher to understand and fix. And whilst deadlocks are painful, race conditions are way worse because they can mean data corruption and you don't necessarily notice them immediately so the amount of corruption can be significant.

James McGovern said...

Check out Azul Systems (They are currently doing 384 CPUs) with several thousand CPU boxes being planned this year...