Question: Question 2 : ( 5 Marks ) CO 2 The following ( code in C ) provides an example of a race condition, if it

Question 2:
(5 Marks)
CO2 The following (code in C) provides an example of a race condition, if it were
executed by two processes roughly at the same time. Explain- whatever bug could
arise for the race condition. Solve the bug using Mutex/Binary Semaphore stating
the differences between MUTEX and Binary Semaphore
int queue[SIZE], i=0;//assume these are shared between processes
void insert(int x)
{
queue[i]= x;
i++;
}
Atomic wait and signal do not violate the mutual exclusion. Explain the reasons?
Question 2 : ( 5 Marks ) CO 2 The following (

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 Programming Questions!