Summary
In this chapter, we saw that Julia provides a simple @thread abstraction to write multithreaded code. However, there needs to be careful consideration when writing code with threads. First, you need to ensure that the number of threads you use is commensurate with the number of CPU cores you have. Second, you need to be careful in accessing global state. And finally, you need to be cognizant of any other threaded libraries within your environment. With those caveats, however, you can achieve impressive performance gains when using threads with Julia.
In the future, this part of Julia will improve significantly. In the meantime, in the next chapter, we will discuss multiprocessing parallelism in Julia. This is something that has been ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access