The answer my book says is x.
But how is that possible? I just learnt from Differnce between Counting and Binary Semaphores that counting semaphores have positive value so that multiple process can access the critical section. So, in that case - how can one say that x processes are waiting, because on reaching 0, the next wait signal will busy-wait a process and the semaphore value can never be less than 0.
Now, there I think can be a second scenario. Like the counting semaphore is initialized to 1. Now, when a process access it, it becomes 0. Next in the wait if we write,
while(s <= 0);
then the next process will make it -1. So, a single process waiting makes the semaphore value -1.
Therefore I can conclude, that for -x, x processes are busy-waiting!
Can someone clarify if I'm right or wrong? Any help is appreciated. Thanks in advance.