This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.
Task
Modify the program that computes \(\pi\) in parallel from the previous exercise so that it uses a shared variable to keep track of the number of points within a unit circle.
That is, instead of defining a counter per thread, define one shared counter.
Use a mutex to avoid race conditions.
Is this new implementation more efficient than the previous one?