Cost of a thread in C++ under Linux
Threads are very expensive if you start throwing C++ exceptions within them in parallel.  You see the overall time to join the threads increases with each thread you add. There is a mutex in the unwinding code and as the threads grab the mutex they invalidate each other's cache line. I wrote a demo to illustrate the problem <a href="https://github.com/clasp-developers/ctak" rel="nofollow">https://github.com/clasp-developers/ctak</a><p>MacOS doesn't have this problem but Linux and FreeBSD do.