Issue with Multithreading spin locks a spin lock solution to the critical path problem is shown below . my question is will this or will this not  result in starvation ?    

    Thread A                Thread B
leave note A;           leave note B;
while (note B) {\\X     if (noNote A) {\\Y
    do nothing;             if (noMilk) { 
}                               buy milk;

if (noMilk) {                  }
    buy milk;           }
}                       remove note B;
remove note A;


let me illustrate my point ,if thread A and B are scheduled as shown wont that result in starvation ? 



note : those arrows are meant to indicate a cycle .

note: I'm following the online operating system course from Berkeley (http://www.youtube.com/playlist?list=PL-XXv-cvA_iCrnl0625nXp4GimjT-cv_1) .

In lecture 4 ,they talk about this as a correct solution to the critical path problem
Process B isn't looping; it runs and then quits. In other words, there won't be a second "leave note B" in your picture. There is a loop in process A (a busy wait, as it's called) and when process B removes its note, then execution will return to A's loop: A will check and see that there is milk so will remove its note and quit.