Previous | Next --- Slide 33 of 60
Back to Lecture Thumbnails
timothy

If you want to mess around with software transactional memory at home and know something like Lisp, I've found Clojure is a great way to do it, because it is in the core language not a library. They have certain operations which can be performed atomically on mutable shared structures, and combined into atomic operations using a version of the atomic keyword called "dosync". It's quite often advertised as one of the great features of the language, as it makes concurrency a lot simpler to do: https://clojure.org/reference/refs.

fractal1729

I thought this motivation for transactional memory was really exciting. I've always thought usage of locks seemed to be really use-case-specific. In particular, the programmer has to be really careful when using locks across multiple threads that interact with the same data structures in complex ways, and there's no generic formula for doing it correctly -- every use case is different and often nuanced in unique ways, mainly due to this composing behavior. On the other hand, transactions seem to be a really slick, highly generalizable way to ensure proper synchronization for arbitrarily complex compositions.

Please log in to leave a comment.