Practice mode Operating Systems

How does a mutex lock differ from a binary semaphore?

Correct answer A. A mutex has an owner and should be released only by the thread that locked it, while a semaphore can be signalled by any thread

Explanation

Both allow one holder at a time, but a mutex has ownership: the thread that acquires it is the one expected to release it, and POSIX error-checking mutexes report an unlock by a non-owner. A semaphore has no owner, so one thread can wait and another signal, which suits signalling between threads. Counting several resources is what a counting semaphore does.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.