But the VarQ is just used in while loop for condition checking, the operations of wait and signal are only on process X?
here while loop acts as wait();
if you didn't get this, think that
depend upon varQ only Process X enters into CS, it uses varQ and varP.