2 Useful Bcdedit Options
Take control of DEP and the number of processor cores
February 23, 2009
In "Bcdedit Basics" (InstantDoc ID 101168) and "Booting Up with Bcdedit" (InstantDoc ID 101362), I showed you how to use Bcdedit to control boot options in Windows Vista and later. (Recent versions of Windows lack the boot.ini text file that pre-Vista systems offered to control boot options.)
Recall that Vista and later keeps its boot information in the Boot Configuration Database (BCD). Your BCD can contain more than one OS entry—a set of configuration information that BCD can use to boot a particular OS on your computer. Most of us have only one OS on our computer, but we might still want more than one OS entry so that we can boot our systems with various options for debugging or analysis. Recall also that Bcdedit identifies OS entries not by user-friendly names but instead by random GUIDs such as \{9c219fb1-bb55-11dd-97ac-804080387aa6\}. Thus, before you can add or subtract options from a particular OS entry, you'll need that OS entry's GUID. Now, I'll put all that background to good use by showing you how to benefit from two of Bcdedit's boot options.
Enabling/Disabling DEP
One useful OS boot option is the nx entry, which enables or disables Windows' Data Execution Prevention (DEP) security feature. By default, Windows enables DEP, which constantly watches for worms attempting to take control of the system. If DEP thinks your OS or application is under attack, it shuts down the affected software. DEP is a good idea and is a major contributor to the fact that we haven't seen a widespread Windows worm since late 2003, but it can burn up a lot of CPU cycles and slow your system down noticeably. In my opinion, DEP's worm-fighting value far exceeds that lost value in system speed, but I do recommend disabling DEP in two cases: on test systems or systems on networks that aren't connected to anything. Many organizations' test systems are either hand-me-downs or virtual machines (VMs), neither of which are very speedy. To disable DEP on those systems, open an elevated command prompt and type
bcdedit /set \[guid\] nx AlwaysOff
Notice that Bcdedit doesn't require a GUID; if you skip it, Bcdedit assumes you want it to work on the currently active OS entry. And please be extremely careful when editing your BCD: You could easily render your system non-bootable. As I've suggested in previous articles, create a separate OS entry and test options there. That way, if you end up disastrously goofing up, you've always got your basic OS entry to fall back on. To re-enable full DEP, type
bcdedit /set nx AlwaysOn
Determining Number of Processor Cores
Another useful Bcdedit option is the numproc option, which lets you determine how many processor cores Windows uses. For example, my laptop runs two processor cores, but I can tell Windows to use only one processor core by typing
bcdedit /set numproc 1
After I did that and rebooted, I took a quick look at Task Manager to see that Windows was indeed running on just one core. Later, I found this option quite useful for smoking out occasional lockups. Now and then, I've seen applications that crash or lock up mysteriously on one system, but not on others—only to realize that the difference was the number of processors in the different systems. The ability to create a separate OS entry and configure that OS entry to run on just one processor (or perhaps two, three, or more) is an easy way to test whether a certain app is experiencing a multiprocessor problem. I like the flexibility of being able to specify the number of processors, but if you need only to compare single-processor scenarios with multi-processor scenarios, you might run across an alternative Bcdedit setting called onecpu, which takes the parameters true or false. Which means that the command
bcdedit /set onecpu true
has the same effect as
bcdedit /set numproc 1
And before you ask, I have no idea why Microsoft offers such redundant options.
More Useful Than You Think
Put nx and numproc in your tweaking and troubleshooting toolkit. You might think they're minor tools, but I bet you find them to be more useful that you thought—I know I did.
About the Author
You May Also Like