Lecture 17
Learning objectives
After this class, you should be able to:
- Use POSIX semaphores to implement correct threaded code for application patterns, such as producer-consumer.
- Use pthreads barrier for synchronization of threads.
Reading assignment
- Section 4.7 - 4.8.
- Lecture 17 slides.
- Lecture 17 example codes.
Exercises and review questions
- Questions on current lecture's material
- Rewrite the
pi
example from the previous lecture's review question so that the threads time the computation of pi. Use barriers to synchronize the threads just before and just after the computation and have thread 0 output the time.- Questions on next lecture's material
- None.