Query regarding the output in multi threading

Sir if we are using the queue which has all the required locks then why in the output published 0 is not coming i:e 0 is coming after published 1 , published 2. It should be like published 0 consumed 0 .