“There are 10 kinds of people in the world: those who understand binary, and those who don’t.”
Process Scheduling
Windows 10 manages CPU prioritization pretty darn good. That doesn’t mean that you don’t have some control over it, and that in turn means you can tweak its behavior to better serve your usage patterns. This week’s Quick Tips article will show you how to make some adjustments to Process Scheduling. If the above Geek Joke eludes you, then by the end of this post you will “get it” and maybe even find it a bit humorous.
Change Process Scheduling Using Windows GUI
Windows allows you to choose a preference between giving more CPU time-slices to either foreground processes, or to background processes. Foreground processes are those you currently have up front and are working with such as programs, utilities, and the like. Background processes are those which don’t have focus but are still necessary, such as printing or making those all-important backups.
It’s very easy to tell Windows how you want to focus your machine:
- Open Control Panel (type control panel in the Start Menu and choose the desktop program from the list)
- In Control Panel, choose System
- In the window that opens, choose Advanced system settings in the left panel
- In the window that opens, click the Advanced tab
- In the Performance section, click the Settings button
- In the Performance Options window that opens, click the Advanced tab
That should bring you to a window that looks similar to this:
If you want the stuff you’re working on to be the priority, then choose Programs. Otherwise, choose Background services. Background services is a common choice for machines being used as servers, for example.
Once you have made your choice, “OK” your way out of all these windows and reboot your computer.
Use The Registry To Further Tweak This Setting
[message type=”warning”]
Standard Registry Editing Warning:
The following instructions will ask you to edit your Windows Registry. Be sure to make a backup of your Registry before you make any changes. Making mistakes in the Registry can cause hard-to-diagnose problems, or even keep Windows from functioning properly. If you don’t know how to back up your Registry, please read Windows Quick Tips – Backup/Restore Registry.
[/message]
We are going to be changing a value in the Registry called Win32PrioritySeparation. This value uses six binary bits to hold its data. I will have to give a brief math lesson about using the Binary system before we continue so you can understand what’s going on here. Don’t worry, it’s not complicated and the bonus is that you will understand that Geek Joke at the beginning of this post.
A Lesson In Binary
A “bit” in Binary-speak, is the smallest unit of measurement. This is comparable to a single digit in the decimal system (0- 9). In Binary, a bit can represent either a zero (0), or a one (1). Binary numbers, just as is true with decimal-based numbers, are calculated from the least significant digits to the most significant digits (right to left).
Note: I learned this cumbersome method back in elementary school. My brother, six years later, learned a different method which was then called Modern Math. This reversed the whole procedure and calculated numbers from left to right. Learning this method made it possible for me to perform some mental mathematical gymnastics which I otherwise would never have been able to do.
The right-most bit is equal to its value multiplied by two to the zeroeth power. So, it can represent either a 0 or a 1. The next bit to the left is equal to its value multiplied by 2 to the power of one. So, its value can either be 0 or 2. Here are a few examples to give you an idea of how this works:
- 00b = 0d
- 01b = 1d
- 10b = 2d (remember that Geek Joke?)
- 11b = 3d
The “b” and “d” represent “binary” and “decimal” respectively. If you want to use higher values, then you have to add more bits. The next bit up the chain is equal to its value multiplied by two to the power of two. So, it can hold either a 4, or a 0. 2 squared is 2 x 2 = 4. So, if that third bit holds a one, then its value is 4, otherwise, it’s a zero. Here are a few more examples to show you how this works:
- 010b = 2d (reading right to left: 0 + 2 + 0 = 2)
- 100b = 4d (0 + 0 + 4 = 4)
- 110b = 6d (0 + 2 + 4 = 6)
- 111b = 7d (1 + 2 + 4 = 7)
As you add more bits, the power of two they represent is increased which in effect doubles their potential value. Four bits can hold values up to 15, five bits can hold values up to 31, and six bits can represent values up to 63. Some of you will have noticed that these numbers are not powers of two, but you must remember that zero is also a number. That six-bit number can now represent 64 different values, which is a power of two.
This may seem confusing to you but you use this method every day with the decimal system. The difference is that you are using powers of 10 for each added digit instead of powers of two. Base 10, get it?
One additional note since we’ll be touching upon it anyway. The hexadecimal system uses a base 16 numbering scheme (0 – F). That’s right, we don’t have an actual single digit to express the value of 15 so we use the letter “F”. A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. As with all numbering systems, the hexadecimal system uses its base as the powers to be multiplied. So, in this case, every new digit is multiplied by a power of 16. The higher the base, the more efficient it is to represent large numbers (1111111111111111b = 65,535d = FFFFh).
Quick Tip: 4 bits is a Nybble and 8 bits is called a Byte. Two bytes is called a Word. Now you know.
Win32PrioritySeparation Settings
This setting tells Windows how you want process scheduling to be prioritized. It uses six bits to store this information. The six bits are divided into three groups, and each pair sends Windows a different message. Here is how they are grouped: [AABBCC].
The most significant bits (AA):
- 00 or 11 – Shorter intervals in Windows 2000 Professional, and longer intervals in Windows 2000 Server
- 01 – Longer intervals
- 10 – Shorter intervals
The middle bits (BB):
- 00 or 11 – Variable-length intervals in Windows 2000 Professional, and fixed-length intervals in Windows 2000 Server
- 01 – Variable-length intervals
- 10 – Fixed-length intervals
The least significant bits (CC):
- 00 – Equal and fixed. The threads of foreground processes get the same amount of processor time as the threads of background processes and as the threads of processes with a priority class of Idle. Also, the processor interval is fixed. This value overrides the specification of a variable-length interval in the middle two bits
- 01 – 2:1. The threads of foreground processes get twice the processor time as the threads of background processes each time they are scheduled for the processor
- 10 or 11 – 3:1. The threads of foreground processes get three times the processor time as the threads of background processes each time they are scheduled for the processor
Default, Programs, or Background Settings
- If you have never changed this setting in the Windows Performance Options discussed earlier, then the default value will be two (2)
- If you have chosen Programs, then the value will be 26h (38d)
- If you have chosen Background services, then this value will be 18h (24d)
Let’s take a look at that Programs setting with a value of 38d. This is how it looks in binary: 10 01 10
- The most significant bits are set to 10. This will use shorter intervals of CPU time
- The middle two bits are 01. This will allow for variable-length intervals
- The least significant bits are set to 10. This sets a 3:1 ratio– Programs:Background services
Here are some settings you might want to play with:
- 0 Foreground and background applications equally responsive (1:1)
- 1 Foreground application more responsive than background (2:1)
- 2 Best foreground application response time (3:1)
Here is a screenshot of the Registry pointing to this setting:
To get to the above window, do the following:
- Use the Windows Key + R to open a Run Box
- Type regedit and hit Enter
- Enter this path (copy and paste) in the Registry Editor address bar: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PriorityControl
- Hit Enter and that should bring you to the Win32PrioritySeparation setting as shown above
You now have all the information you need to make educated choices regarding this important setting. You’ll notice that I changed mine back to the default value of two (2). So far, I like the way my system is responding. Your needs will vary, of course, depending on how you use your computer.
I know I harp on this a lot, but please, please make a Registry backup before experimenting with this. Or better yet, an entire system backup might be in order. Anyone can make a mistake and the Registry is an unforgiving place. I would truly hate to have someone writing to me about how this article was cause for mucking up their computer. You have been warned…
Note: I read and re-read this post countless times trying to make sure I didn’t make any conversion errors. If I missed an error, you can have a go at me in the comments 😉
As always, if you have any helpful suggestions, comments or questions, please share them with us,
Richard
—
Richard, very informative and well-stated article. I have checked the post and saw no conversion issues. Your recommendation of backing up the reg is also good advice.
Recommendations: Outside the scope of the article, I would recommend using the free (Home Edition) of Registrar Registry manager from Resplendence to make registry changes. (www.resplendence.com/main)
It has a quick “Backup and Restore” button making it very easy to create a backup. It also has a unique Data editor that accessed by double-clicking on the binary number to quickly display the Decimal, Hexadecimal & Binary equivalents.