I read about semaphores in "Operating System Concepts" (for those of you who know this), and I thought I understood the semaphores completely until I read this passage:
A critical aspect of semaphores is that they execute atomically. We must ensure that two processes cannot wait and operate on signals on the same semaphore at the same time.
And:
If the hardware does not contain any special atomic instructions, we can use any of the software solutions for the critical section of the problem, when the critical sections consist of a wait and a signal of the procedure.
This passage refers to the face Signaland the Waitoperation must be atomic. I thought the whole purpose of the semaphore was to allow only one process in the critical section at any given time - if I need to use another algorithm (for example, a bakery algorithm), why do I also need a semaphore?
I understand that my question can be confusing. If this is so, it is only because the subject is still vague for me, so even asking a question is a little difficult.
I would like to read any clarifications ...
source
share