classCCSTM extends CCSTMExecutor with STMImpl with Factory
The reference STM implementation for scala.concurrent.stm.
The reference STM implementation for scala.concurrent.stm. CCSTM is a
library-only STM based on the SwissTM algorithm, extended to reduce the
overhead of non-transactional accesses, allow partial rollback, and include
modular blocking and composition operators retry and orAtomic.
During construction the system property "ccstm.stats" is checked. If it is
"true" or "1" (actually if it starts with any of the characters 't', 'T',
'y', 'Y', or '1') then statistics are recorded while the program runs and
printed to Console during JVM shutdown.
Statistics are tracked separately for top-level transactions and true
nested transactions. Many nested atomic blocks can be merged into the
top-level transaction by CCSTM for efficiency; these are not reported as
nested.
Reported statistics are either counts or exponential histograms. For
histograms sum is the sum of the samples, count is the number of
transactions for which the statistic was non-zero, avg is sum/count
and the histogram reports in brackets the number of samples that had a
value of 1, 2..3, 4..7, 8..15, and so on.
Counters:
commits -- committed transactions
alternatives -- alternatives provided to atomic, one sample per call
to atomic
retrySet -- memory locations watched while performing modular
blocking, one sample per top-level blocking event
retryWaitElapsed -- milliseconds elapsed during modular blocking, one
sample per top-level blocking event
explicitRetries -- explicit retries using retry, retryFor,
Ref.View.await or Ref.View.tryAwait
unrecordedTxns -- rollbacks that were to erase a successful use of
atomic.unrecorded
optimisticRetries -- rollbacks that were automatically retried, one
line per OptimisticFailureCause.category
failures -- rollbacks that were not retried, one line for each type of
exception in UncaughtExceptionCause
blockingAcquires -- internal locks that could not be acquired
immediately
commitReadSet -- optimistic Ref reads, one sample per committed
top-level transaction
commitBargeSet -- locations read pessimistically, one sample per
committed top-level transaction
commitWriteSet -- locations written, one sample per committed
top-level transaction
rollbackReadSet -- optimistic Ref reads, one sample per transaction
that was rolled back
rollbackBargeSet -- locations read pessimistically, one sample per
transaction that was rolled back
rollbackWriteSet -- locations written pessimistically, one sample per
transaction that was rolled back
Read and write set counts for a nested transaction are merged into its
parent if it commits, they are not counted separately during the nested
commit.
The reference STM implementation for
scala.concurrent.stm
. CCSTM is a library-only STM based on the SwissTM algorithm, extended to reduce the overhead of non-transactional accesses, allow partial rollback, and include modular blocking and composition operatorsretry
andorAtomic
.During construction the system property "ccstm.stats" is checked. If it is "true" or "1" (actually if it starts with any of the characters 't', 'T', 'y', 'Y', or '1') then statistics are recorded while the program runs and printed to
Console
during JVM shutdown.Statistics are tracked separately for top-level transactions and true nested transactions. Many nested atomic blocks can be merged into the top-level transaction by CCSTM for efficiency; these are not reported as nested.
Reported statistics are either counts or exponential histograms. For histograms
sum
is the sum of the samples,count
is the number of transactions for which the statistic was non-zero,avg
issum/count
and the histogram reports in brackets the number of samples that had a value of 1, 2..3, 4..7, 8..15, and so on.Counters:
commits
-- committed transactionsalternatives
-- alternatives provided toatomic
, one sample per call toatomic
retrySet
-- memory locations watched while performing modular blocking, one sample per top-level blocking eventretryWaitElapsed
-- milliseconds elapsed during modular blocking, one sample per top-level blocking eventexplicitRetries
-- explicit retries usingretry
,retryFor
,Ref.View.await
orRef.View.tryAwait
unrecordedTxns
-- rollbacks that were to erase a successful use ofatomic.unrecorded
optimisticRetries
-- rollbacks that were automatically retried, one line perOptimisticFailureCause.category
failures
-- rollbacks that were not retried, one line for each type of exception inUncaughtExceptionCause
blockingAcquires
-- internal locks that could not be acquired immediatelycommitReadSet
-- optimisticRef
reads, one sample per committed top-level transactioncommitBargeSet
-- locations read pessimistically, one sample per committed top-level transactioncommitWriteSet
-- locations written, one sample per committed top-level transactionrollbackReadSet
-- optimisticRef
reads, one sample per transaction that was rolled backrollbackBargeSet
-- locations read pessimistically, one sample per transaction that was rolled backrollbackWriteSet
-- locations written pessimistically, one sample per transaction that was rolled backRead and write set counts for a nested transaction are merged into its parent if it commits, they are not counted separately during the nested commit.