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, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 24.06.2019 20:00
Individuals suffering from technology overload feel distressed when deprived of computers and mobile devices.true/fasle
Answers: 2
question
Computers and Technology, 25.06.2019 08:50
The purpose of this problem is to write some small functions and practice passing things around amoung functions.1) the main function shall ask the user to enter three numbers and read the three numbers.2) write a function named findsum that takes three numbers as arguments and returns their sum. the main function shall call this function.3) write a function named findaverage that takes the sum and the number of numbers and returns the average. the main function shall call this function.4) write a function named findsmallest that takes the three numbers and returns the smallest value. the main function shall call this function.5) the main function shall print the results in the following format, with two decimal positions and the decimal points aligned:
Answers: 3
question
Computers and Technology, 25.06.2019 09:00
(environmental science semester 1) which statement best describes the limits of science? a. science cannot answer any abstract questions. b. when used properly, science can answer any questions. c. usually science can answer only mathematical questions. d. science cannot answer religious questions.
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
question
Mathematics, 13.10.2020 06:01
question
Health, 13.10.2020 06:01
question
Mathematics, 13.10.2020 06:01
question
Mathematics, 13.10.2020 06:01
question
Mathematics, 13.10.2020 06:01
question
Mathematics, 13.10.2020 06:01
Questions on the website: 13722360