Question: 5 . The following is a solution to solve the shared account balance problem. Proc _ 0 ( ) 1 / * Enter the CS

5.The following is a solution to solve the shared account balance problem.
Proc_0()1
/* Enter the CS */
P(mutex) ;
balance += amount;
v(mutex) ;
semaphore mutex =1;
fork (proc_0,0):
fork (proc_1,0);
proc_1()|
1* Enter the CS */
P(mutex) ;
balance -= amount;
v(mutex) ;
5.1. suppose we change the line "semaphore mutex =1; " to "semaphore mutex =0; ". Is the solution still
correct? Please briefly explain. (5 points)
5.2.suppose we change the line "semaphore mutex =1; " to "semaphore mutex =2;,". Is the solution still
correct? Please briefly explain. (5 points)
 5.The following is a solution to solve the shared account balance

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!