Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semaphores notation - why V and P instead of S and W

I am asking this question because I'm trying to get the notation to stick in my head. My lecturer said that V and P are the first letters of the dutch words for signal and wait, but this is not true.

Does anyone know what words V and P abbreviate or did Dijkstra just pick his favorite two letters?

like image 508
boris dzhelali Avatar asked Nov 10 '13 05:11

boris dzhelali


People also ask

What do P and V signify in a semaphore?

● 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.

What does the value of semaphore signify?

The value of the semaphore S is the number of units of the resource that are currently available. The P operation wastes time or sleeps until a resource protected by the semaphore becomes available, at which time the resource is immediately claimed.

Which code changes the value of semaphore?

1 Answer. The explanation is: None.

Which semaphore is easier to implement?

Binary semaphores are sometimes easier to implement. than counting semaphores.


1 Answers

From Wikipedia's Semaphore (programming) article and a copy of Dijkstra's work:

  • Probeer te verlagen (P) means 'try to decrement'
  • Verhogen (V) means 'increment'

P has the Proberen... (try) term in front of the meaningful verlagen (decrement) term because the Dutch words for increment and decrement both start with "V". Dijkstra added the "try to" words in front of the meaningful "decrement" term so that there would be a simpler way of distinguishing between the two functions.

like image 99
Blue Ice Avatar answered Oct 01 '22 22:10

Blue Ice