Is is possible to configure Windows to only use a single hardware-thread. Every machine for the last couple of years seems to be at least dual-core, but some timing bugs are only reproducible when threads execute serially. I am particularly interested in Windows Vista.
4 Answers
David, let's first tackle your direct question: How to restrict Windows Vista to one core.
I see two ways:
(a) Run your Vista in a virtual machine on Hyper-V, and give the VM only one logical processor. This leaves you the rest of the machine to put to good use.
(b) Alternatively, you can use the /numproc=1 option in boot.ini to force the machine to use a single processor. You can configure this through msconfig.
- Click Start, click Run, type msconfig, and then click OK.
- Click the "Boot" tab.
- Click "Advanced options..."
- Click to select the "Number of processors" check box, and select "1".
- Click OK two times, and then restart the computer.
alt text http://i39.tinypic.com/141789i.png
But maybe it is enough to restrict just your program to a single core, then setting processor affinity is the preferrable answer. This can be achieved through configuration or directly from your process code.
Appart from these you might also want to consider advanced multitreading debugging tools such as Intel's Thread Checker if that applies to your environment.
![](../../users/profiles/4979.webp)
- 1,473
- 9
- 11
What you're looking for is how to set the 'process affinity', and how you set it depends on what program you are starting, and how you are starting it up.
I saw this answer on stack overflow: stackoverflow.com/questions/827754/....
Also many machines can have SMP (& hyperthreading if relevent) disabled in the BIOS.
Timing bugs (or the common subset of race conditions) seem to be more generally reproducable on multi-core machines.
![](../../users/profiles/3489.webp)
- 6,466
- 19
- 26
-
Most, but not all. I once found a bug in a FindBugs which was only reproducible of a single threaded machine. – Tom Hawtin - tackline May 27 '09 at 02:45
You would want the /onecpu switch in boot.ini look at here: http://support.microsoft.com/kb/170756
![](../../users/profiles/6522.webp)
- 597
- 2
- 5