O'Reilly logo

Clojure Applied by Alex Miller, Ben Vandgrift

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5Use Your Cores

Servers, laptops, and even phones these days are built on multicore chips with multiple independent threads of control available for programs to use. We need to design our programs to take full advantage of these chips. Clojure was born in and designed for this multicore world.

Most of the problems with concurrency in languages like Java are problems of managing shared mutable state. As we’ve seen, Clojure relies primarily on immutable data (which can be safely used across threads). We’ve also seen how explicit state can be created using the stateful containers (atoms, refs, agents, and vars). All of these containers use a common update model whereby state is always transformed from one immutable value to another with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required