As we live in this new multi-processor world, I thought it would be a good idea to try and utilise the multi-threaded model for those programs that lend themselves to it.

One such program extracts data (lots of it) from various databases (DB2, SQL Server and Oracle), processes it and creates an Excel workbook containing the results. This data is independent for each of our locations, 31 in all, so I thought of creating a thread for each location.

This works fine and runs like a banshee on my 4 Core Pentium with 4GB RAM with the operating system appearing to do a good job of balancing the threads across the 4 processors. However, when this program goes into production I cannot guarantee that the production computer will be a powerful as my desktop.

So, my question is this. As you can retrieve the number of processors on your computer via the NUMBER_OF_PROCESSORS environment variable, would it be worth my while to code for the possibility of a single processor? Is the coding effort worth the savings of not having the OS create and manage the multiple threads?

My logic would be:

If MultipleProcessors Then
End If

There's a split here as to the merits of this. One camp saying that I should let the OS decide and not be bothered and the other saying that any performance gain is worth the effort. I'll be very interested to hear the thoughts of the loungers.

Kevin Bell