Programming in Clojure (Part 7 Concurrency)

markm208

Mark Mahoney

Posted on April 18, 2021

Programming in Clojure (Part 7 Concurrency)

This post covers concurrency in Clojure. This is a big topic. I start by discussing threads. Then I talk about different strategies for dealing with data that is shared among different threads.

Concurrency

Call to Action

Problem 1
This lab asks you to create a Clojure program that will count how many primes are in a given range. Create a thread pool and have each thread check a single number in the range. If it finds a prime it will increase a counter (which should be an atom since it is shared by all of the threads). Look at the program above on Atoms as a starting point

Comments and Feedback

You can find all of these code playbacks in my free 'book', An Animated Introduction to Clojure. I am always looking for feedback so please feel free to comment here or to send me a message. You can follow me on twitter @markm208.

💖 💪 🙅 🚩
markm208
Mark Mahoney

Posted on April 18, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related