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 14:40
You begin your first day of responsibilities by examining the recent is security breach at gearup to get ideas for safeguards you will take. at gearup, criminals accessed the company's improperly-secured wireless system and stole customers' credit card information as well as employee social security numbers. what kind of computer crime did gearup face?
Answers: 3
question
Computers and Technology, 23.06.2019 10:00
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
question
Computers and Technology, 23.06.2019 19:50
Which feature is selected to practice and save the timing of a presentation
Answers: 1
question
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
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
Questions on the website: 13722362