[concurrency-interest] Latency in starting threads
kirk at kodewerk.com
Wed Apr 17 01:08:38 EDT 2013
> In my experience, currentTimeMillis() gives good results if used correctly.
That is my experience also.
>> System.currentTimeMillis() might jump around
>> with system time
>> System.currentTimeMillis() works quite fine if you use NTP daemon. The NPT slows down or speeds up the system clock frequency very slightly to adjust, hence no jumps.
In order to keep the right time, xntpd must make adjustments to the system clock. Different operating systems provide different means, but the most popular ones are listed below.
Basically there are four mechanisms (system calls) an NTP implementation can use to discipline the system clock (For details see the different RFCs found in Table 4):
settimeofday(2) to step (set) the time. This method is used if the time if off by more than 128ms.
adjtime(2) to slew (gradually change) the time. Slewing the time means to change the virtual frequency of the software clock to make the clock go faster or slower until the requested correction is achieved. Slewing the clock for a larger amount of time may require some time, too. For example standard Linux adjusts the time with a rate of 0.5ms per second.
ntp_adjtime(2) to control several parameters of the software clock (also known as kernel discipline). Among these parameters are:
Adjust the offset of the software clock, possibly correcting the virtual frequency as well
Adjust the virtual frequency of the software clock directly
Enable or disable PPS event processing
Control processing of leap seconds
Read and set some related characteristic values of the clock
So, I suspect no jumps in this case.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest