Does anybody know why semaphore operations are called P and V? Every time I read a chapter on semaphores it says something like the following:
In order for the thread to obtain a resource it executes a P operation. And in order for the thread to release a resource it executes a V operation.
What does P and V stand for? Why they are not called wait and signal?
P semaphore function signals that the task requires a resource and if not available waits for it. ● V semaphore function signals which the task passes to the OS that the resource is now free for the other users.
A simple way to understand wait (P) and signal (V) operations is: wait: Decrements the value of semaphore variable by 1. If the new value of the semaphore variable is negative, the process executing wait is blocked (i.e., added to the semaphore's queue).
They are required to be to ensure that one thread cannot obtain resources while another thread does. If it wasn't, this would imply that two threads could begin accessing a resource and then be switched out of the CPU and another process could gain access to it instead.
Semaphores are integer variables that are used to solve the critical section problem by using two atomic operations, wait and signal that are used for process synchronization. The wait operation decrements the value of its argument S, if it is positive.
Dijkstra, one of the inventors of semaphores, used P and V. The letters come from the Dutch words Probeer (try) and Verhoog (increment).
See also: https://cs.nyu.edu/~yap/classes/os/resources/origin_of_PV.html
@Kris answer is just partially right.
V stands for 'Verhoog' and P stands for 'Prolaag', not 'Probeer' as cited here.
Verhoog can be translated as 'increasing'. Decreasing would be 'Verlaag', but for better distinction between the letters Dijkstra invented the word 'Prolaag'.
See the naming in the original paper.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With