This preview shows page 1. Sign up to view the full content.
Unformatted text preview: t than semaphore operations.
Aside: Pthreads signals vs. Unix signals Pthreads signals are totally unrelated to the Unix signals that we learned about in Sectionsec:ecf:signals. Unix signals have been around since the early days of Unix. Pthreads is a more modern development dating from the mid 1990s. It is unfortunate that the Pthreads standards group decided to use the same term, but the terminology is ﬁxed and we must accept it. In this chapter, we are only dealing with Pthreads signals. End Aside. 11.5.3 Barrier Synchronization
In general, we ﬁnd that synchronizing with mutex and condition variables is more difﬁcult and cumbersome than with semaphores. However, a barrier is an example of a synchronization pattern that can be expressed quite elegantly with operations on mutex and condition variables. 588 CHAPTER 11. CONCURRENT PROGRAMMING WITH THREADS A barrier is a function, void barrier(void), that returns to the caller only when every other thread has also called barrier. Barriers are essential in concurrent programs whose threads must progress at roughly the same...
View Full Document