It may come as news to some, but Windows isn't always the best when it comes to real-time operations.
Mostly Windows' real-time performance lags are because pretty much everything you need to do in the OS doesn't need that sort of instant granularity, but there are cases sometimes when it matters -- especially, for example, when it comes to streaming video and audio, video and audio production and even games. Problems here can be exhibited through stuttering, dropouts, or pops and crackling with sound even when your system resources or network bandwidth don't appear to be taxed.
The spikes visible here show where latency is excessively high.
Part of the problem lies with how Windows handles requests from drivers for your hardware. By default, Windows tries to keep data flowing for any device that needs it, but if multiple devices all want to do something at the same time, Windows has to moderate who gets to do what. Typically this happens through interrupts, which allow devices to signal the processor that they need attention. At any time your computer could be handling hundreds (even thousands) of interrupts, and to ensure everyone gets a fair go drivers are coded to use what's known as a Deferred Procedure Call (DPC). Here Windows will acknowledge a request and then put it in a queue to be serviced at the first available opportunity. The queue is a first-come first-serve basis and means if you have a device streaming data needing attention, it needs to wait its turn.
Normally this shouldn't be a problem as each device gets limited attention from the CPU before moving on to the next request, so the delay isn't long enough to allow a video or audio streaming program's buffers to empty.
However drivers for hardware can sometimes be coded badly and allow the device they support to hog their time in the limelight from the CPU. The result is that the next DPC request can be delayed and, if that request is from a device streaming data, the delay can be long enough to cause dropouts and stuttering in programs that are waiting on data.
Solving latency issues
This is where a nifty little program called DPC Latency Checker bit.ly/2lnYFD comes in. It allows you to see in real-time the maximum DPC latency occurring on your system, in milliseconds. If you run it while using your normal programs, especially those that stream data, you'll get to see how quickly your system responds to DPCs. Streaming programs having a problem getting data will likely stutter or drop out at the same time you see a spike in the DPC Latency Checker.
If dropouts have been a problem, the good news is now you know why. The bad news is it's not necessarily easy to fix.
As mentioned above, poorly coded drivers are typically the source of DPC latency issues. Devices on the PCI bus are also prime suspects, as PCI interrupts (IRQs) are often shared between more than once device.
Finding the culprit is a matter of deduction. It helps that most common causes of DPC latency issues relate to devices that stream data: wired network controllers, wireless controllers, TV tuners and sound cards. In fact, wireless controllers are generally considered the number one culprit when DPC latency issues are encountered, so focus on this first.
In some cases, solving a DPC latency issue could be as simple as moving a sound, network or wireless card to another PCI slot in the computer.
If this isn't possible because the device is built in, as with laptops and modern PCs that pack USB, networking and sound controllers on the motherboard, the next best thing to try is to disable them in the system's BIOS. If you're not familiar with your PC's BIOS, you can typically enter it by holding the Delete key (though different vendors sometimes use different keys -- if need be, look it up in the manual). Then find the location for device management and disable from there.
If disabling via the BIOS isn't an option for whatever reason, the alternative is to disable suspects in the Windows Device Manager ('Control Panel > System & Security > System > Device Manager') and see if that fixes the latency issues. Simply right-click on a device and select 'Disable', then reboot. Note: be careful not to disable any device that's critical to your system, like storage controllers or display adapters.
If you happen to find a device at fault, updating to the latest driver for it may fix your issues. If it doesn't, there's really only one avenue left: get rid of the device and replace it with a different brand if it's a desktop, or leave it disabled if the device is integrated. Unless, of course, you can't live without it, for example the in-built wireless controller in your laptop.
Note that other causes of DPC latency include power saving modes on CPUs, like the C1E and C6 modes and Intel's EIST (Enhanced SpeedStep). So try disabling these in the BIOS also, especially if you have a desktop as these modes are less important than to a laptop.
A higher-performance timer
Another factor that can impact DPC latency is the system timer. Typically this is the TSC (Time Stamp Counter), but modern systems have a more reliable and higher resolution timer called HPET (High Precision Event Timer). HPET is known to increase DPC latency, and many tech sites recommend disabling HPET in the system's BIOS. However this isn't the whole story -- one of the functions of HPET is to help synchronise multimedia streams, facilitating smoother playback of video and audio. Think of it as HPET is useful for rendering multimedia streams, while DPC latency issues affect the stream itself.
In reality, the increase in DPC latency that HPET adds isn't an issue. By way of example, in our testing on an Intel Core i7-based system, the average DPC latency with and without HPET enabled was 90ms and 10ms respectively. Anything less than 100ms is good and, as the DPC Latency Checker states, anything up to 500ms is just fine.