# 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) {

if (noMilk) {                  }
}                       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) .