Actually in B) code is working like this
-------------------------------------------------------------------------------
At first producer and consumer both are active state
Now, initially count =0
So, Say consumer active this part of code
if count = 0
And stop now
And producer starts and executes this part
place item in buffer.
count = 1;
Wakeup(Consumer);
Now producer goes to sleep
Consumer active now execute next part of it's code
then sleep;
Remove item from buffer;
count = 0;
Wakeup(Producer);
Consume item;
So, at first it get instruction for sleep and it also goes to sleep
Both are in sleep mode now :)