In this chapter, we have shown you how to write multithreaded code to make full use of modern computers with multiple CPU cores. However, sometimes you do not have to make any effort to use multiple threads in your program. Many libraries bundled with Julia create their own threads. Most important among these is OpenBLAS, the library used in Julia for matrix operations. OpenBLAS is very efficient at using threads, and hence, if your algorithm is mainly performing matrix multiplication or factorization, you will get multi-core performance automatically.
You can verify the fact that running the following code exercises all your cores by watching performance counters on your machine:
julia> a = rand(1000, 1000);
julia> b = rand(1000, 1000);
julia> @btime $a*$b;
34.593 ms (2 allocations: 7.63 MiB)
On macOS or Linux, the htop command shows us CPU usage, which...