ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 10 Weeks Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 12 May 2017 My Price 8.00

For the bakery algorithm in Section 2.2.2

1)For the bakery algorithm in Section 2.2.2, the value of number[i] is not

bounded.

(a) Explain how the value of number[i] grows without bound.

(b) One suggestion for bounding the value of number[i] is to replace the

statement

number[i] = max(number) + 1;

with the statement

// numThreads is # of threads in the program

number[i] = (max(number) + 1) % numThreads;

Is this suggestion correct? Explain.

2)Suppose that we switch the order of the first two statements in Peterson’s
algorithm:
boolean intendToEnter0 = false, intendToEnter1 = false;
int turn; // no initial value for turn is needed.
T0 T1
while (true) { while (true) {
turn = 1; (1) turn = 0; (1)
intendToEnter0 = true; (2) intendToEnter1 = true; (2)
while (intendToEnter1 && (3) while (intendToEnter0 && (3)
turn == 1) {;} turn == 0) {;}
critical section (4) critical section (4)
intendToEnter0 = false; (5) intendToEnter1 = false; (5)
noncritical section (6) noncritical section (6)
} }
Does the modified solution guarantee mutual exclusion? Explain. If
yes, does the modified solution guarantee progress and bounded
waiting? Explain.

Answers

(11)
Status NEW Posted 12 May 2017 03:05 AM My Price 8.00

-----------

Not Rated(0)