Question: Process 1 and Process 2 are concurrent processes that share variables A and B. Jack has developed what he thinks is a satisfactory program synchronizing

Process 1 and Process 2 are concurrent processes that share variables A and B. Jack has developed what he thinks is a satisfactory program synchronizing the sharing. The relevant part of the program is shown below. Jill looks at the program and tells Jack that she things there are problems with his solution. Do you agree with Jack or Jill? Explain your decision. if you think there are problems, explain what they are; if not, justify your belief that Jack has written a correct program.

shared int A=0; B=0; //shared variables

semaphore semA=1; semB=1; //declare and initialize semaphores to protect variables

Process 1

Process 2

...

...

P(semA);

cin>>x>>y;

cin>>A;

P(semB);

...

B=x+y;

P(semB);

P(semA);

A=B+3;

B=A+B;

V(semB);

V(semA);

V(semA);

V(semB);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!