SuperTutor

(15)

$15/per page/Negotiable

About SuperTutor

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

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,Engineering,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 233 Weeks Ago
Questions Answered: 12843
Tutorials Posted: 12834

Education

  • MBA, Ph.D in Management
    Harvard university
    Feb-1997 - Aug-2003

Experience

  • Professor
    Strayer University
    Jan-2007 - Present

Category > Programming Posted 18 May 2017 My Price 8.00

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

(15)
Status NEW Posted 18 May 2017 08:05 AM My Price 8.00

-----------

Not Rated(0)