Minimalistic Software Transactional Memory

Paul Rubin http
Thu Jan 10 21:28:45 EST 2008


Fuzzyman <fuzzyman at gmail.com> writes:
> STM isn't lock free - it just abstracts the locks away from the
> 'user'. You still need to lock around committing the transaction.

The idea is that readers don't need locks.  They just look at the
version number before they start reading and after they finish.  If
the number didn't change, the read was successful.  If it changed,
they have to retry.

On multiprocessor systems this relies on an instruction like CMPXCHG
for writers to increment the version number.  Otherwise it requires a
lock separate from the version number, and multiple operations on the
lock.



More information about the Python-list mailing list