Starvation is possible or not? let S and Q to be initialized to 1 

process p0:          process p1:

wait(S);             wait(Q);
wait(Q);             wait(S); 

..                    ..
..                    ..
Signal(S);           Signal(Q);
Signal(Q);           Signal(S);


I know there is a deadlock , where both the process will be going into the sleep , so what about starvation and bounded waiting?

My approach:

as only p0 can be executed any number of times i think there will be starvation and no bounded waiting.But answer is given that there is No Starvation.
The answer is wrong.

Deadlock implies starvation, and the given code suffers from deadlock, here's how.

Say p0 executes wait(S); and then p1 executes wait(Q);. Now both the semaphores S and Q have value = 0.Now p0 will keep on waiting due to statement wait(Q); and p1 will keep on waiting due to statement wait(S);.

Freedom from starvation means that:


  if a thread tries to acquire a lock , it will eventually succeed.


This does not happen here, so the answer is wrong.