I then wrote a pair of programs which revealed what was going on. It holds each timer interval request for four seconds, and then goes to the next one, wrapping around when it is done. It does this by gathering three pieces of information. FelixPetriconi ran the tests for me on Windows 10 and I ran the tests on Windows 10 The results cleaned up to remove randomness are shown here:.
What this means is that timeBeginPeriod still sets the global timer interrupt interval, on all versions of Window. We can tell from the results of timeGetTime that the interrupt fires on at least one CPU core at that rate, and the time is updated. Note also that the 2. I guess? However the scheduler behavior changes dramatically in Windows 10 Previously the delay for Sleep 1 in any process was simply the same as the timer interrupt interval with an exception for timeBeginPeriod 1 , giving a graph like this:.
However what about with an 8 millisecond interrupt interval? They could sleep for two cycles but that would give an average delay of 16 ms, and the measured value is more like Therefore three calls to Sleep 1 resulting in a average delay of This variation in the handling of Sleep 1 happens sometimes at other timer interrupt intervals but is most consistent when it is set to 8 ms.
The intentional inconsistency in the Sleep 1 delays is particularly worrisome. Maybe it is a bug, but I doubt it. I think that there is complex backwards compatibility logic behind this. But, the most powerful way to avoid compatibility problems is to document your changes, preferably in advance, and this seems to have been slipped in without anyone being notified. Most programs will be unaffected. If a process wants a faster timer interrupt then it should be calling timeBeginPeriod itself.
That said, here are the problems that this could cause:. Since both Chrome and Visual Studio have a habit of doing this I had to do most of my experimentation with no access to the web while writing code in notepad. Apparently the unit tests for this blog post failed. So if one process has set Hz, and another has the default 64Hz it will only wake up every second time since you can fit two periods of the global wakeup in the 64Hz.
This is probably a good way to save power, I doubt it was done to reduce the effect one process has on another. WTF is that, it seems bots are copying content, swapping random words and reposting on some generic looking sites..? That sounds like good advice. Okay, pingbacks deleted. On a modern machine, could the OS apply different interrupt frequencies on different cores?
That could affect other processes if they happen to get scheduled on that core while the greedy process is sleeping. Actually that sounds like this is an adaptation for ARM processors where there are low performance cores in additional to high-performance cores.
Whether that helps depends a lot on the CPU design how isolated the power domains of different processors are and other factors too complex for me to want to analyze. I must add this to my ever-growing list of things to look into, but where is the Great Rule Change?
But the rule applied for real as early as version 3. The rule had to be established early even if the implementation was for many years rudimentary because as much as an operating system for programs in general wants to give each program the illusion of owning the computer, delivering this ideal for access to an interval timer is all but impossible. These interrupts are almost necessarily a shared resource.
If you need that your wait for 10ms be 10, not 11, then you tell Windows you want 1ms resolution. What is mad is to depend on the precise implementation. They make a rod for their own backs by skimping on the documentation, making it inevitable that programmers end up grasping at every implementation detail they can find.
As you note, the new behaviour you see looks to be an attempt at improvement. Put aside whether they can be if well written.
There is plausibly some waste in making a thread ready earlier than its process has indicated is tolerable. I expect, though, that compatibility considerations apply. A programmer that plays the game of calling timeBeginPeriod must know that other programs may play too. Such programs may have coordinated. They may better be left alone. So I should not be surprised if waste elimination is sought only or first for processes that do not play the game.
This brings me to your graphs. Your graph of old behaviour can be explained very well — indeed, by the simple model you present in which the caller of Sleep 1 becomes ready for return at the first timer interrupt that occurs 1ms or more after making the call. Assume the interrupt period is constant, having been set by the other program and not changed by any other. The first Sleep 1 is random with respect to these interrupts.
All the remainder are called soon after an interrupt. Over a long enough run, you measure the average time in calls to Sleep 1 that are syncronised with interrupts. Mostly then, you just measure the interrupt period. But your calls to Sleep 1 are not random!
The great rule change is that the effect of timeBeginPeriod used to work one way, and now it works another, and this difference has not been documented. This broke at least one program, and almost certainly more. It would just be good for the official documentation to say what I discovered through experimentation here.
It was a long comment because I wanted to present my case carefully that there is no rule change. What you present as the new rule is what the rule really has been all along.
True, their documentation is terrible, and so misunderstanding is inevitable. But do you not think programmers bear some responsibility too to think through the consequences of what they depend on?
Please be a good citizen. Use no more of this feature than you really do need. Less flippantly, I do agree with you that since Microsoft did document the implementation detail without spelling out that it was not to be depended on and since programmers inevitably will have depended on it, Microsoft ought to bear some cost and write some better documentation.
We must be arguing semantics because it is quite clear that the behavior has changed. Since the reality of this change is indisputable you must be arguing about whether that counts as a rule change, which seems like an uninteresting argument. I disagree with that analysis, and I also think you could present that argument much more clearly if you condensed it down to a single sentence, instead of a mini blog post. See the first sentence of this paragraph for an example.
I know of one program that was broken and had to be modified because of this change. Very interesting read! But after version something changed. Glovepie lets you set how fast the script is run from 0hz to hz and now it can only run scripts in 64hz. So when running scripts that requires smooth operations like mapping head movements to mouse movements everything is skippy and stuttery, Bummer.
Maybe be more specific, and less ad-hominem. There is another place where you can see that something has changed, which is the powercfg energy report. If you scroll down a bit, there is also an information about the current global timer resolution of the system.
Actually, I like this change. Personally I have stopped using it because it just reports the timer frequency at a point in time, which is surprisingly unhelpful. I agree that this change is for the better.
Thanks for writing this up. Thanks for sharing. I also came across another Google system that had the same sort of dependency.
Luckily I was able to recognize what was going on from the ETW trace that they shared and solve their mystery quickly. Good point on the confusion caused by Windows 10 The naming convention should have been or I updated it to avoid future confusion. Ie instead of a global change, it just affects each individual call, allowing the OS to use whichever interrupt accuracy to fulfill the user requests as well as possible for a non-RT OS?
Each time a process requested a different sleep resolution the OS would potentially have to reprogram the timer interrupt, which is probably not cheap. I think the goal was that those few programs that needed a raised timer interrupt frequency would request it for a while. Have you tested this with Windows 10 Game Mode disabled? I wonder if that is the source of this new behavior. It seems that the call affects a single process not system, not only threads. I launched a process for each physical core 6 cores, 6 threads , using properties — Process.
ProcessorAffinity and — ProcessThread. ProcessorAffinity — ProcessThread. What do you think? That is consistent with my results. When it comes to the user interface, CookTimer is one of the simplest timer apps for Windows you can find. So, if the simplicity matters to you, and you just want your clock to tick, CookTimer might be into consideration. The alarm sound is not working on Windows 10? It also offers a few more features, like the ability to reset the timer by itself, or ring forever when the time is up.
You can turn on both features from the main window, which also appears to be the only window CookTimer has.
You set up a timer, and get notified when it does its thing. Get CookTimer. This tiny program allows to manage alarms, make an action after the time expires, receive notifications, and more. You can set up alarms, and even use a customized alarm sound. Additionally, SnapTimer can run a certain program or app, after the time expires, which is quite a unique ability. Get SnapTimer. MultiTimer is another Windows 10 app that, as its name says, allows you to set up a couple of timers.
The app can also run in the background, which can be a huge plus for many users. MultiTimer offers quite good management options to keep all these timers under control. Timers can be grouped together as logical units, as well as combined together to run as a sequence.
The fact that this app offers a lot of customization options when it comes to setting up a timer, also tells us that MultiTimer is all about timer management. MultiTimer is available for free on both Windows 10 and Windows 10 Mobile, and you can download it from the Microsoft Store.
Get MultiTimer. CoolTimer is the oldest program on our list, and one of the pioneers of timer programs for Windows. Fix it now by following this useful guide. You can even choose a notification sound from its own library, or upload your custom sound, and use it as an alert.
It also comes with changeable skins and themes, which gives this app a special charm. Get CoolTimer. Expert Tip: Some PC issues are hard to tackle, especially when it comes to corrupted repositories or missing Windows files. If you are having troubles fixing an error, your system may be partially broken. We recommend installing Restoro, a tool that will scan your machine and identify what the fault is.
Click here to download and start repairing. It actually wakes up your computer from standby or hibernation. The process is simple, you set up the time when you want your computer to wake up from sleep, you put your computer to sleep, and WakeupOnStandBy wakes it up automatically.
Want to be more organized? Check out this list with the best weekly planner software for Windows There are even more automatization options you can perform with WakeupOnStandBy. For example, you can program it to repeat the process every week, in two weeks, on particular days, and so on.
Besides waking up your computer from sleep, WakeupOnStandBy can also serve as your alarm clock. Get WakeupOnStandBy. These apps have similar features as the Windows 10 ones, and you can use them without any issues. The process of setting up a timer is very straightforward, you just circle a dot around the interface, and set a timer that way looking familiar to the Surface Dial?
You can set up a sound effect or vibration to pulse as time comes down. But if you find these sounds annoying, you can work in the silent mode, as well. If you want to know how to set a timer with Cortana on Windows 10, check out this awesome guide.
Perfect Timekit is another extremely useful time management app for Windows 10 Mobile. It is one of the most feature-rich apps for time management you can find in the Store right now. Besides the regular timer, Perfect Timekit also offers you alarms, stopwatch and a World clock. The user interface of Perfect Timekit is gorgeous and very straightforward. When you open the app, you can choose what you want to use — Alarms, Stopwatch, Timer, and World clock.
When you open the alarm feature, you set it by sliding around two dots that represent hours and minutes. Windows 10 has a clock and you can set up as many locations around the world as you want. It sure reminds me of one of the clocks they show in the doomsday movies. I hope this is not a doomsday clock though! And it actually works.
I hope you find a way to put them to good use! Maybe you like peace and quiet? Nothing wrong with that! Your email address will not be published. Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page.
0コメント