[concurrency-interest] tsc register

David M. Lloyd david.lloyd at redhat.com
Fri Jan 13 10:13:01 EST 2012


On 01/12/2012 11:13 PM, David Holmes wrote:
> Mohan Radhakrishnan writes:
>> I meant that since this CR is recent even newer VM's could be affected
>
> That CR has nothing to do with the TSC.
>
>> ? I think if I were to set the thread affinity using JNI and
>> continuosly run java threads then that is the test case. Am I right ?
>
> If you bind a thread to a given core (using JNI) and that thread reads the TSC then it should always be reading the same TSC. But remember there are two issues with using the basic TSC: synchronization across processors and stability of the frequency of updates. Thread affinity only addresses one part.

Synchronizing TSC across processors seems like a non-requirement from 
our perspective.  As long as the TSC value is saved and restored on 
context switch, each thread will see a monotonic increase, right?  And 
really that's about as much as you ought to expect out of nanoTime().

--
- DML


More information about the Concurrency-interest mailing list