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 part of the language from the beginning and is a stable and widely used mechanism for achieving parallelism in Julia today.
...