subject

Ten children wait to get their gift. Each child gets its turn[i] by computing a number[i]. A clown has in his hat ten balls; each ball has a unique number, from one to ten. After all children have their turn set, the clown is ready to share the gifts. The clown picks a random ball, and gives a gift to the child(ren) whose turn value is the same as the number on the ball (after that, he throws away the selected ball). Once the clown has no balls left, he leaves. (Shared variables) turn() = 0 i= 1, ... 10 (N=10) number[= 0; called/=0; numBalls= 10 child (int i) { clown() { number[i] =1+max (number[1], number(2)... number[N]); while (numBalls > OX turn[i] = number[i]; pick a ball; Il sleep while (!called[i]){ }; for(int j=1; j<=N; j++){ get the gift; Il sleep if(turn[i] == number on the ball){ numBalls- called[i] = True; go home; Il sleep give the gift l/sleep } } // for } // while leave; } llclown Note: you can break down the computation of number into: load , compute, store All child() processes and clown execute concurrently. a) Is it possible for two children to store the same value for numberſij? (for example number[2] = 2 and number[3] = 2) If yes, give the execution sequence that shows it. If no, explain why not.
b) On the hypothesis that each child has a different number(i), is it possible for two or more children to have the same value for their turn variable? Explain. If yes, give the execution sequence that will show it. If not possible, explain why.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Are special characters that allow you to search for multiple words at the same time.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
The valves of the heart and veins are similar in that they both
Answers: 1
question
Computers and Technology, 25.06.2019 03:00
What judgment would you make about open systems interconnect? not useful that it is a technology that it is a model that it does not pertain to technology
Answers: 1
You know the right answer?
Ten children wait to get their gift. Each child gets its turn[i] by computing a number[i]. A clown h...
Questions
question
Mathematics, 29.05.2021 21:50
question
Business, 29.05.2021 22:00
Questions on the website: 13722366