http://jaoo.dk/aarhus-2009/file?path=/jaoo-aarhus-2009/slides/RichHickey_TheClojureConcurrencyStory.pdf
All functional programming languages emphasize working with immutable data as much as possible. How can that be efficient, and what benefits does it bring? And what happens when you need state, to manage changing values over time? One method is to use mutable references with concurrency semantics, such as transactions, coupled with persistent data structures. This combination makes for easy, lock-free designs, well within the comfort zone of those used to imperative programming.
This talk discusses how immutability, state and identity are handled in the Clojure language. You'll learn details about Clojure's managed references, agents and STM.
Target audience: Developers interested in alternative approaches to concurrency.
Интересные мысли.
ОтветитьУдалить"Path coping" for Map
"Separates identity and value" for Ref
"One timestamp CAS is only global resource" in STM realization
";refs
(dosync
(alter foo assoc :a "lucy"))
;agents
(send foo assoc :a "lucy")
;atoms
(swap! foo assoc :a "lucy")"
А вообще простое введение в модель concurrency в Clojure.