CS 551: Distributed Operating Systems
Disadvantages of Semaphores

Disadvantages of Semaphores

Simple algorithms require more than one semaphore.
    This increases the complexity of semaphore solutions
        to such algorithms.

Semaphores are too low level.
    It is easy to make programming mistakes
        (e.g. P(s) followed by P(s)).

The programmer must keep track
    of all calls to wait and to signal the semaphore.
If this is not done in the correct order,
    programmer error can cause deadlock.

Semaphores are used for both condition synchronization
    and mutual exclusion.
These are distinct and different events,
    and it is difficult to know which meaning
        any given semaphore may have.

What happens if system crashes
    when one process is in the critical section?

Since semaphores can be tricky,
    can we create other constructs from them
        that might be easier to use?

Copyright © 2001-2003: Colorado State University for CS 551. All rights reserved.