DEV Community

Cover image for Programming in Clojure (Part 7 Concurrency)
Mark Mahoney
Mark Mahoney

Posted on • Edited on

2

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay