[dmd-concurrency] What about optimistic concurrency control?

Tim Matthews tim.matthews7 at gmail.com
Thu Jan 7 00:28:35 PST 2010


So dmd-cc. Whats your opinion on an optimistic concurrency? Heavy exlusive
transactions on not allways ideal but an optimistic based approach allows
more computation to just keep on running.

This sort of approach which is sometimes called STM (software transactional
memory) can crunch a whole lot more numbers if we think "this lock is
probably not in use by anyone else, just go for it":

1) Save a copy/hash of the computations dependencies (arguments to functions
that are passed by ref)
2) Do the computation.
3) If dependencies have changed go to step 1 else commit.

If such algorithms were implemented they should preferably be made implicit
with algorithms generic enough for handling any kind of arguments, rolling
back etc. If the function doesn't modify any state other than the target
result then this could reduce complexity a lot but not necessarily
impossible to do with other styles.

I'm not sure if the semantics of D's current pure function implementation
could be the base of such algorithms but how much of a speedup is the
current D pure optimizations giving us anyway?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-concurrency/attachments/20100107/7f98ef3e/attachment.htm>


More information about the dmd-concurrency mailing list