Why not "weakNanoTime" for jdk9?

Robert Stupp snazy at snazy.de
Fri Mar 6 23:50:27 UTC 2015


> Am 07.03.2015 um 00:27 schrieb Aleksey Shipilev <aleksey.shipilev at oracle.com>:
> 
> I disagree on this premise. In the absence of proper API for CPU
> affinity and CPU frequency control, we *do* need monotonicity and
> linearity guarantees.

+1 on that.

The problem is that there is nothing like CPU affinity out of the box in Java. I.e. some option to declare a "critical section" that must not be interrupted or even moved to another core.
What I'd really like to see is some kind of @com.sun.CriticalSection on a method which guarantees that there will be no context switch during execution. I don't have timing stuff in mind - but concurrent data structures.
If there would also be a way to inquire the current core, that could really help with some concurrent data structures.
Additionally if there's a way to define CPU affinity per Java Thread or thread group even more fancy data structures could be possible (although there's already some project that already does this).

Have to admit, that I've no real clue how expensive it is to enter or leave such a "critical section".

—
Robert Stupp
@snazy




More information about the core-libs-dev mailing list