|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.multiverse.api.clock.RelaxedPrimitiveClock
public final class RelaxedPrimitiveClock
The RelaxedPrimitiveClock is less strict about increasing the clock. It finds it OK if someone has increased the clock instead of it insisting that it wants to increase the clock as well. Synchronization (commit locks) should prevent transactions sharing state to execute concurrently, so only independent transaction increase the clock.
The reason why this implementation exists, is that it causes less stress on the memory bus because compare and swaps are done. This clock is based on the optimization TL2 V4 made by David Dice. The RelaxedPrimitiveClock is a first and simple step forwards to prevent contention on the memory bus. The ideal situation would be if the STM didn't rely on a shared clock, so that independent transactions can scale linearly. The experimental STM implementation for the .NET platform already has realized this, at the cause of having potential zombie threads; threads that have entered an illegal state and possibly could enter some kind of non terminating loop 'before' being aborted because the transaction failed to commit.
| Constructor Summary | |
|---|---|
RelaxedPrimitiveClock()
Creates a RelaxedPrimitiveClock with 0 as begin version. |
|
| Method Summary | |
|---|---|
long |
getVersion()
Returns the current version of this PrimitiveClock. |
long |
strictTick()
Executes a strict clock tick by increasing the version. |
long |
tick()
Executes a clock tick by increasing the version. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RelaxedPrimitiveClock()
| Method Detail |
|---|
public long tick()
PrimitiveClockPrimitiveClock.getVersion() method will always return a time equal
or larger than.the last tick.
The returned value could be stale as soon as it is received.
tick in interface PrimitiveClockPrimitiveClock.strictTick()public long strictTick()
PrimitiveClockPrimitiveClock.tick() is that the former will always increase the version for every calling thread and the
is allowed to return the same version for concurrent ticks.
The returned value could be stale as soon as it is received.
strictTick in interface PrimitiveClockPrimitiveClock.tick()public long getVersion()
PrimitiveClock
getVersion in interface PrimitiveClockpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||