Question: Two concurrent processes A and B are running on a single processor system. Each process, among other code segments, needs to access a certain system

 Two concurrent processes A and B are running on a single
processor system. Each process, among other code segments, needs to access a

Two concurrent processes A and B are running on a single processor system. Each process, among other code segments, needs to access a certain system resource in mutually exclusive manner within a loop. resource access is performed by invoking a function called Accesso, as shown below. Process A: Process B: while (1) while(1) { Access: Access(); } We want to make sure that: The Access function() is called only by A or B at a time (the mutual exclusion requirement), Process A should be the first process to call Access(); - Process B shouldn't be allowed to make back to back calls to Access(); - Process A should be the first process to call Access(); - Process B shouldn't be allowed to make back to back calls to Access(); - Processes shouldn't experience unnecessary delays subject to the constraints above. For example: ABAABA is a legitimate access order, while ABABBABA is not in the second one, process B calls Accesso) twice in a row. Show how you can solve this problem using semaphores (provide the updated pseudo-code). Important the Access() function is given to you, but you cannot edit it. Add your pseudo-code in other places in the codes of A and B lie. before and/or after Access(). Achieve the specified behavior by using semaphores. From a given process, you can't call a function defined in another process. Make sure to indicate the initial values of all your semaphore variables (otherwise it will be assumed that they have the value of zero as the initial value). You cannot assign a negative initial value to a semaphore. As we discussed during the lectures, you can access a semaphore only through wait() and signal() function, for instance, if S is a semaphore, you can't use statements such as "S=S+1" or "if(50) Your solution should avoid deadlocks, starvation, race conditions, and busy waiting

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!