Take the 2-minute tour ×

I have an application that's having some trouble handling multi-processor systems. It's not an app that I have a particular affection for modifying and would like to avoid it if possible. However, I'm not above modifying the code if I have to. The application is written in VBA (and hence my inclination to avoid touching it).

We've noticed that the application seems to run pretty smoothly if we set the processor affinity to a single processor using task manager, only manifesting instability when processor affinity isn't set.

I know that I can specify the processor affinity of a task using .NET and as such, there lies a possibility of me writing a shell application that could be used to run legacy applications with a specified processor affinity, does anyone have any experience with this and can throw out some ideas as to headaches I'm likely to run into with this approach?

The other question is: Is it in fact possible to modify the core VBA product to handle its own processor affinity? I've never had to handle this with any of my applications natively so this (at this point in time) is completely outside my realm of expertise.

Thanks in advance

share|improve this question
I'd be interested to know what problems you're seeing when the processor affinity is not set. How do these problems manifest themselves? –  Gary McGill Jun 1 '10 at 13:32
@Gary McGill: The problems we're seeing (with Access 2003 which the app was written for - and won't work in Access 2007/2010) are application crashes and general Access instability. The app was originally written on single CPU/single Core machines that we're now having problems replacing. The app has all kinds of instability on multi-CPU and multi-core machines, but still works fine on the older machines. When we set the processor affinity, the instability ceases to be a problem. The app is being rewritten, but until it's complete we're stuck between a rock and a hard place. –  BenAlabaster Jun 2 '10 at 16:16
Are you using multiple threads within the VBA application? If restricting a multi-threaded app to a single processor improves performance, that is usually indicative of a false caching issue –  Jason Coyne Jun 24 '10 at 20:51
add comment

2 Answers

up vote 2 down vote accepted

One way you can do this is with the Windows Application Compatibility Toolkit.

You give it a way to identify your application (e.g. by .exe location), and then it allows you to specify a number of tweaks. Processor affinity is one of them. It creates a database that holds all your tweaks.

It's per-machine, so it's not a good solution for a widely-distributed application, but if this application only has to run on one machine, it'll save you having to change the code.

share|improve this answer
Also, be aware that by default version number is one of the items it selects to identify your application. If you regularly change version numbers on updates, you may want to uncheck that as a criterion or your tweaks will stop working with your next upgrade. –  Kyralessa May 31 '10 at 18:19
add comment

You could use Sysinternal's PsExec to start your application with a certain processor affinity, e.g. to bind Access to CPU 1 call

psexec.exe -a 1 "%ProgramFiles%\Microsoft Office\Office12\access.exe"

To answer your second question: As you tagged the question with access-vba I assume that your VBA code is an Access solution. Your VBA code will then be executed in process, i.e. you will have to modify the processor affinity of the access.exe process. It is not possible to modify the affinity of the VBA engine separately.

However, before you specify a processor affinity make sure that you are fully aware of the consequences. Fiddling around with this setting can have undesired effects. For a good example read Raymond Chen's post:


share|improve this answer
Our I.T. manager found this hack to make an app that doesn't handle multi-core/multi-processor environment well. I.T. is testing if modifying processor affinity will stabilize the app. If it is, then it'll be an I.T. initiative. I was asked to provide input from a development standpoint. –  BenAlabaster May 31 '10 at 17:12
add comment

Your Answer


