What is the difference between semaphores and mutex provided by pthread library ?
What is the difference between semaphores and mutex provided by pthread library ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
semaphores have a synchronized counter and mutex’s are just binary (true / false).
A semaphore is often used as a definitive mechanism for answering how many elements of a resource are in use — e.g., an object that represents n worker threads might use a semaphore to count how many worker threads are available.
Truth is you can represent a semaphore by an INT that is synchronized by a mutex.