"Il y a peu de choses qui me soient impossibles..."
In the spin delay case, it's the same core running all the time.
"Il y a peu de choses qui me soient impossibles..."
Steffe Wilson wrote:...after you do the sleep call RunInPlace say 20 times and see if the values stabilise.
I'm wondering about whether the system stabilises as you get further away from the sleep.
"Il y a peu de choses qui me soient impossibles..."
"Disappointing" and "Utterly Horrible" are not equal.
Tim Holloway wrote:Time slices can expire even when you are within system service code, and as a result, brute-force timing will vary.
The sleep function is even worse. The documentations should have in fact informed you that there are no warrantees express or implied about its exact duration. What the sleep function does is set up an expiration time, then yields to the dispatcher. The actual wakeup time will occur after the expiration time has passed AND the task dispatcher has determined that no other processes/threads should be scheduled ahead of the one that is sleeping.
Tim Holloway wrote:The sleep function is even worse. The documentations should have in fact informed you that there are no warrantees express or implied about its exact duration. What the sleep function does is set up an expiration time, then yields to the dispatcher. The actual wakeup time will occur after the expiration time has passed AND the task dispatcher has determined that no other processes/threads should be scheduled ahead of the one that is sleeping.
"Il y a peu de choses qui me soient impossibles..."
Steffe Wilson wrote:
Tim Holloway wrote:Time slices can expire even when you are within system service code, and as a result, brute-force timing will vary.
Neither of these characteristics could account for the observed behaviour though could they?
"Il y a peu de choses qui me soient impossibles..."
"Disappointing" and "Utterly Horrible" are not equal.
Tim Holloway wrote:Well, as I mentioned, sleep actually yields the timeslice on the spot. A spin will not.
Incidentally, when doing stuff like that my logic looks more like this:
nanoTime javadoc wrote:one should use t1 - t0 < 0, not t1 < t0, because of the possibility of numerical overflow.
The QueryPerformanceCounter FAQ wrote:How often does QPC roll over?
Not less than 100 years from the most recent system boot, and potentially longer based on the underlying hardware timer used. For most applications, rollover isn't a concern.
"Il y a peu de choses qui me soient impossibles..."
Steffe Wilson wrote:...after you do the sleep call RunInPlace say 20 times and see if the values stabilise.
I'm wondering about whether the system stabilises as you get further away from the sleep.
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:Your theory appears to be correct. Whatever it is about Sleep that causes subsequent code to run slow, it "wears off" after a while.
Paul Clapham wrote:There's maybe some underlying regularity there but you'd need to get the statisticians from CERN involved to identify which bosons are in action.
"Il y a peu de choses qui me soient impossibles..."
Steffe Wilson wrote:
Stevens Miller wrote:Your theory appears to be correct. Whatever it is about Sleep that causes subsequent code to run slow, it "wears off" after a while.
Very interesting. Well the reason I was thinking along those lines was because I wondered whether the sleeps could be having an effect on the CPU scheduling.
"Il y a peu de choses qui me soient impossibles..."
"Disappointing" and "Utterly Horrible" are not equal.
"Il y a peu de choses qui me soient impossibles..."
Tim Holloway wrote:To measure intervals, again, you have to be careful what resources you call on, because the granularity of the timer being queried...
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
"Disappointing" and "Utterly Horrible" are not equal.
Tim Holloway wrote:how's your physical/virtual memory set up? When a task switches page faults often follow. Even when they don't, the CPU instruction caches may be depleted.
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
1201ProgramAlavm wrote:This sounds like it is due to the reduced clock speed that the CPU will run at when the computer is not busy (SpeedStep). When the computer is idle (like in a sleep) the clock speed will drop to reduce power consumption. On newer CPUs this can be 35% or less of the listed clock speed. Once the computer gets busy again there is a small delay before the CPU will speed up again.
You can turn off this feature (either in the BIOS or by changing the "Minimum processor state" setting under "Processor power management" in the advanced settings of your power plan to 100%.
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:Well, hoodly-doo, they cracked it!
Stevens Miller wrote:After some of the typically obnoxious comments one gets at StackOverflow (and, gawd, I am so grateful to JavaRanch for creating an atmosphere of respect and encouragement in this place),
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|