Synchronization primitives: Mutex and Semaphore (Condition Variables) - Article 11
Hi Folks, In previous articles, we have understood the synchronization constructs Mutex and Semaphore. Semaphore is a superior construct compared to a Mutex. Mutex is just a lock where as Semaphore can be used to solve variety of problems. I have explained Mutex & Semaphore using pseudo code and in recent articles, I have provided real PThreads & Mutex code which can be executed & tested in Linux. Going forward, we shall explore Condition Variables & the differences between Mutex & Semaphore. We shall also write some real Semaphore code in Linux. We shall also solve few more synchronization problems & conclude Mutex & Semaphore. In this article, let's explore the concept of Condition Variable. -> Mutex is just a locking mechanism. -> Semaphore can be used as a lock or as a signalling mechanism. Now, how can we use Mutex to solve serialization problems? That's where Condition Variables come into the picture. When we use the combinati