Synchronization with Semaphores
Semaphores can be used to solve any of the traditional synchronization problems, but suffer from several problems:
1. semaphores are essentially shared global variables
2. there is no connection between the semaphore and the data being controlled by the semaphore
3. Use same mechanism for scheduling and synchronization.
4. they can be accessed from anywhere in the code
5. there is no control or guarantee of proper usage
So, semaphores are sometimes hard to use and prone to bugs.
One solution is to provide programming language support for synchronization.
- Why does putting something in the language make it harder to misuse?