Semaphores provide a mechanism to regulate access to resources. Unlike locks,
semaphores aren't tied to particular scalars, and so may be used to control
access to anything you care to use them for. Semaphores don't limit their
values to zero and one, so they can be used to control access to some resource
that there may be more than one of (e.g., file handles). Increment and
decrement amounts aren't fixed at one either, so threads can reserve or return
multiple resources at once.