Good Observation but you miss one thing ..
Now have look at Option B
We have S0=0 the S1=1 and the S2=0 ..now
We can only execute the Process P1 so
Down(S1) so S1=0 now and we have Up(S0) so S0=1 and S2=0 ...
So we can execute the Process P0 ..Down(S0) so S0=0 and Printf...And UP on S1 and S2 so S1=1 and S2=1 ....
No problem upto this ....we have correcty printed the statement Exactly once ...
But look at semaphore we have
S0=0 the S1=1 and S2=1 ....
You cant execute P1 REASON : its not in the LOOP of while and we have already executed it once so P1 option is gone ..
But we can go For P2
So Down on S2 possible and S2=0 but S1 already 1 and even if we perofrom UP on S1 we have S1=1 only ...
That's it ...You are freeze ..you cant do anything as semaphore values are
S0=0 ; S1=1 and S2=0 ....
Now you cant execute P2 and P1 as they are already executed once ..
so OPTION B fails ..
Point to be observe is P1 and P2 are not in infinite LOOP they can be executed only once ...