Friday, November 7, 2008

Multi Threading

Multi-threaded programs have been marked as the next big thing. With the recent shift in processors from improvements in speed to improvements in number of cores instead, there is a stronger push for creating more multi threaded applications.

The problem with this is that creating multi-threaded applications is hard, except for a few classes of applications where this already occurs. Things need to happen in sequence, and there is only so much that can be done to change that. The processor companies want programmers to create applications which can get better by just adding more cores, so that they can sell more.

That is not the best use of the programmers time. In general, a programmer may have to work harder to improve performance, and a program may only get faster by making it smarter, rather then the underlying processor just getting faster.

But with the proliferation of smart phones (iPhone, Blackberries, ect.), subnote books and netbooks, pure speed is no longer the driving factor. So programs will have to be made to run with lower speeds, and not multi core. So the focus should be on creating tools to help programmers improve performance in general, not just for a specific optimzation of multi threading.

There are plenty of applications where multi threading will be beneficial, and nothing special needs to be done to take care of. A great example is webservers and web applications. Having mroe threads means it can server a larger number of people. As more and more new and existing applications are ported to the web, servers will need to handle more and more demands. So you have this split of writing applications for the personal computer, in what ever form only have limited resources and needing to optimize for that, then the big computers running the web based software which will naturally benefit from the increase in cores with out much additional effort of the programmers.

There is no real crisis coming up. Yes programmers will have to work harder to improve performance, but the performance increases will not come in the means of multi threading (in most cases anyways) but from other areas. They will still receive free performance enhancements as SSD drives become prevalent and disk speeds start to scale, along with increases in performance in memory in general.

Edit: I came across this after writing this entry about P-Completeness here and here that talks about issue of some problems just being inherently serial and that there is no way to create a solution using parallel processes.