Thus, only one process will buy milk. Suppose B goes on vacation. A will buy milk once and won't buy any more until B returns. Therefore at most one process will buy milk. If one process goes on vacation after step 7, the other process will still buy milk.
Solution is almost correct.
If NoteA then A is buying or will buy milk. If NoteB then B is buying milk or thinking about it. If B does buy milk then A will see that at A10. If B doesn't buy milk after all, then after A9 it will be safe for A to buy milk. This solution works.