subject

A software approach to mutual exclusion is Lamport’s bakery algorithm [LAMP74], so called because it is based on the practice in bakeries and other shops in which every customer receives a numbered ticket on arrival, allowing each to be served in turn. The algorithm is as follows: boolean choosing[n];
int number[n];
while (true) {
choosing[i] = true;
number[i] = 1 + getmax(number[], n);
choosing[i] = false;
for (int j = 0; j < n; j++){
while (choosing[j]) { };
while ((number[j] != 0) && (number[j],j) < (number[i],i)) { }; } /* critical section */;
number [i] = 0;
/* remainder */;
}
The arrays choosing and number are initialized to false and 0, respectively. The ith element of each array may be read and written by process i but only read by other processes. The notation (a, b) < (c, d) is defined as: ( a < c ) or ( a = c and b < d )
Describe the algorithm in words.
Show that this algorithm avoids deadlock.
Show that it enforces mutual exclusio

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Martha is a healer, a healthcare provider, and an experienced nurse. she wants to share her daily experiences, as well as her 12 years of work knowledge, with people who may be interested in health and healing. which mode of internet communication can martha use?
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
question
Computers and Technology, 23.06.2019 12:40
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
You know the right answer?
A software approach to mutual exclusion is Lamport’s bakery algorithm [LAMP74], so called because it...
Questions
question
Computers and Technology, 27.09.2019 19:20
question
Computers and Technology, 27.09.2019 19:20
Questions on the website: 13722360