02 June 2008

Introduction to Control Theory and Its Application to Computing Systems -- Part 1

Part 1 of the slide presentation.

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# joe pendergast said:

Until microsoft supports accurate time (via the HPET or some other device) the mere mention of control theory and windows in the same breath tests credibility.

The lack of accurate time is such a severe deficiency that it really precludes using windows as a platform for a product in many cases even when a client asks for it.

It forces one to use Linux.

Please.

Please!

Provide sub-microsecond accurate time support on XP,Server 2008,server 2003

29 December 08 at 1:27 AM
# MarkBFriedman said:

Joe,

Ah, clocks and timers!!! Great question. A very interesting topic. Accurate clocks are so important for measurement and other applications like control engineering. Unfortunately, the timing facilities in Windows are not as well-documented as they should be.

I assume you are not interested in issuing an rdtsc instruction and are familiar with the inconsistencies associated with that hardware timing facility. In Windows 2000, XP and Server 2003, the QueryPerformanceCounter() API issues an rdtsc instruction to provide precision timing information.

*** I should note that the hardware vendors are rapidly addressing the inconsistencies associated with rdtsc in the past. On most current processor hardware, all the clocks on a socket are synchronized and they maintain a constant tick rate, even across power management events that change the clock rate of the processor. ***

In response to the very visible issues with rdtsc, QueryPerformanceCounter() was changed in Vista and Windows Server 2008 to use the HPET instead, when it is available.

Was that what you were asking about?

BTW, if you are writing managed code, the Stopwatch() class is a thin wrapper around QueryPerformanceCounter().

This fix in Windows version 6 is hardly a panacea, however. The latency associated with calling the HPET is approximately 1 microsecond, which strikes many of us as an excessively long time. (For one thing, the long latency renders the number of bits of timer precision that are available pretty irrelevant.)

We expect that the new version of Windows 7 will make some further improvements in the QPC() routine. As soon as we are permitted to discuss these improvements here in public, we will.

What with the hardware improvements and the new support in the next version of Windows, we are pretty upbeat that there is a solution in hand for Windows developers. I am told there is even progress coming in the virtualization arena, which currently relies on software emulation of the hardware timing facilities, which leads to extremely imprecise clocks and timing. In Hyper-V, for instance, this plays havoc with any and all measurements that rely on precise intervals timers. This is very frustrating at the moment!

In the meantime, keep in mind that the precision of the clock is not the entire story. And that precision clocks and timers is more of a hardware issue than a software one. (The Linux OS faces the same set of issues on Intel-compatible hardware.)

-- Mark

29 December 08 at 6:00 PM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker