ietf-smtp
[Top] [All Lists]

Re: productivity?

2011-08-23 08:48:34

Hector Santos wrote:

Timing is everything, yet it needs to be understood how it can give you unpredictability. Windows is not an RTOS (Real Time Operating System) where such timing predictions are guaranteed. For example, it is often misunderstand what the actually elapse time are.

      Sleep(0)  15 ms,  return immediately
      Sleep(1)  15 ms,  Thread is Queued
      Sleep(21) 20 ms,  Thread is Queued
      Sleep(36) 45 ms,  Thread is Queued

Oops, Sleep(21) is 30 ms!  The granularity is 15ms.

FYI,

You can use change it to 1 ms using the Multimedia Media API library functions.

   timeBeginPeriod(1);
   timeEndPeriod(1);

http://msdn.microsoft.com/en-us/library/dd757624(v=vs.85).aspx

And this can be another factor in confusing developers that their software is perfect but can't explain why other people have problems. Its a global setting and if some other application running (doesn't have to be multi media related) changes it for its own needs, you might begin to develop code and think its all perfect, but then PUFF - during testing or other users that don't have the global 1ms resolution turned on, have problems.

That is one of many reasons synchronization based on time can bite you.


--
Sincerely

Hector Santos
http://www.santronics.com


<Prev in Thread] Current Thread [Next in Thread>