Today in class we talked about concurrency and parallelism. I wanted to provide you with a small example of multi-threaded code using C++11 threads. The code is located at:
You’ll see two example programs–one uses mutexes to control access to shared state, and the other doesn’t. If you run these programs, you should be able to see the benefits of mutexes in controlling access to shared resources.
For project 1, you are free to use C++11 threads, or pthreads, whichever you’d prefer.