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