Processor bottlenecks occur when the processor is so busy that it cannot respond to requests quickly. Excessive processor activity can be identified by
As you monitor processor and related counters, you can recognize a developing bottleneck by the following conditions:
Hardware or Software
Our methodology in troubleshooting is to continue to Divide and Conquer. If it has been determined that we have high processor utilization because of high values of the % Processor Time counter, we can continue our problem isolation strategy by asking the question
The cause of a processor bottleneck can be determined by examining 2 additional counters.
Subsequently we can examine the processor utilization of each process to determine which processes are causing the high processor utilization.
Solutions for processor bottlenecks
If the high processor utilization is caused by faulty drivers or faulty application software, we need to get the software fixed or replaced. If the high processor activity is caused by the normal activity, we need to acquire upgraded hardware or reorganize our software schedule.
When a program is loaded in Windows, it becomes a running process. Each process has at least one thread of execution which is the path of programmed instructions. Windows supports multi-threaded application which allows a process to have concurrent operations; i.e. multitasking within the process. Windows assigns the use of the processor to individual threads and keeps track of state information for each thread.
Multitasking works best on computers with multiple processors. Windows directs threads to run on available processors. Windows tries to run available threads on the same processor that they used previously. This mechanism is call processor affinity and takes advantage of the contents of a processors cache; L1, L2, and L3 if available.
The System, Processor, Process, and Thread objects contain counters that provide useful information about the work of your processor. Examine the following counters for details about computer processes.
Every thread has a numeric priority. The OS scheduler dispatches the highest priority thread to an available processor. If there is more than one thread at the same priority they form a queue. There is a ready queue for each of the 32 priorities. Task Manager can be used to change a process's relative thread priority within a priority class. The numeric priorities are illustrated in the following table. System Monitor can be used to monitor a thread's priority.
Process Priority Classes With Relative Thread Priorities
Thread State Transitions
As threads are initialized they are placed in the appropriate priority queue in a Ready state. The thread at the front of the highest priority queue is placed in the Standby state. When the processor becomes available, the operating system scheduler selects the Standby thread and puts it into the Running state. If the thread needs to wait for an I/O event, it will go into a Wait state. If it runs for its complete time-slice (quantum), it will be preempted and put back into its priority queue.
Thread State Counter Values
System Monitor can display the state of each thread using the following numeric values.
Interrupt Request Level (IRQL)
The IRQL is the priority ranking of an interrupt. A processor has an IRQL setting that threads can raise or lower. Interrupts that occur at or below the processor's IRQL setting are masked and will not interfere with the current operation. Interrupts that occur above the processor's IRQL setting take precedence over the current operation.
The particular IRQL at which a piece of kernel-mode code executes determines its hardware priority. Kernel-mode code is always interruptible: an interrupt with a higher IRQL value can occur at any time, thereby causing another piece of kernel-mode code with the system-assigned higher IRQL to be run immediately on that processor. In other words, when a piece of code runs at a given IRQL, the Kernel masks off all interrupt vectors with a lesser or equal IRQL value on the microprocessor.
Some interrupts are more important, or higher priority, than others. For example, system clock timer interrupts are central to many of Windows functions including preemptive multitasking. As a result, timer interrupts are treated as having higher IRQL interrupt request level and therefore a higher priority than interrupts caused by peripheral devices such as printers and modems.
Note that thread dispatching is sometimes handled by sending a special interrupt called a DPC deferred procedure call. Both DPC's and APC asynchronous procedure calls are like bookmarks: they tell the processor to do the task requested when it has no higher-priority interrupts. Only when there are no interrupts at all does a thread actually execute.
IRQ Levels Logic for interrupt handling
Interrupt Service Routines
When an interrupt occurs, it is serviced by an ISR interrupt service routine. Data structures called an IDT interrupt dispatch tables define which interrupt service routine will handle the interrupts occuring at each IRQL.
The kernel supplies the interrupt service routines for many system interrupts such as clock ticks, power failure, and thread dispatching. Other interrupt service routines are provided by the device drivers that manage peripheral hardware devices such as network adapters, keyboards, and disk drives.
When an interrupt occurs at one IRQL, all interrupts at or below that IRQL are blocked or masked. If an interrupt occurs at a higher IRQL, then the higher priority interrupt is serviced immediately.
The Windows Resource Kit includes an example called CPUStres.exe that will provide an artificial processor load on your system. Examine the options of CPUStres and view the effects with System Monitor.