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 04:30
Kyle, a receptionist for a building supply company, recently won an award for saving his company money on their phone system. after being presented with kyle's research, the company changed the way in which it made long-distance phone calls and cut their expenses in this area by 75 percent. the new system the kyle's company most likely adopted was wired communications switching stations voip hdtv
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
List the five on-board vehicle subsystems
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, 16.04.2021 15:40
question
Mathematics, 16.04.2021 15:40
Questions on the website: 13722367