Staying Out of Trouble
As I pointed out at the opening of this chapter, dealing with multiple threads is one of those great power versus great responsibility situations. Programming with multiple threads opens up the possibility that you can keep all your CPU cores busy doing productive work. But multiple threads also means dealing with the headaches—and dangers—that come with trying to do more than one thing at a time.
So far in this chapter we have walked through some of the obvious threads fighting over resources problems, but threads come with some other, less obvious dangers. For example, threads are expensive: creating a new thread takes a long time, and each thread takes up a reasonable chunk of memory.
Thus if you just want to get ...
Get Getting Clojure now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.