The psuedocode of Lamport’s bakery algorithm is given below….

The psuedocode of Lamport’s bakery algorithm is given below. Fully explain one example of how it can be “unfair”.   boolean[n] choosing;int[n] ticket;startThreads();Txvoid main() { int x = threadNumber; while (!done) { choosing[x] = true; ticket[x] = maxValue(ticket) + 1; choosing[x] = false; for (int i = 0; i < n; i++) { if (i == x) continue; while (choosing[i] == true) ; while (ticket[i] != 0 && ticket[i] < ticket[x]) ; if (ticket[i] == ticket[x] && i < x) while (ticket[i] != 0 && ticket[i] == ticket[x]) ; } /* CRITICAL SECTION GOES HERE */ ticket[x] = 0; /* non-critical code */ }}

Give an example of how an algorithm might use spatial locali…

Give an example of how an algorithm might use spatial locality to fetch pages in an anticipatory scheme. For this question you do not have to use an actual algorithm covered in class. If it’s easier, you can just describe what an algorithm might do to accomplish this goal