Question: (30 points) Consider the code below for allocating and releasing processes: #define MAX PROCESSES 255 int number of processes = 0; /* The implementation of

(30 points) Consider the code below for allocating and releasing processes: #define MAX PROCESSES 255 int number of processes = 0; /* The implementation of fork() calls this function */ int allocate processes() { int new_pid; if (number_of_processes == MAX PROCESSES) return -1; else { /* allocate necessary process resources */ number_of_processes++; return new_pid; } } /* The implementation of exit() calls this function / void release process() { 1* release resources */ number_of_processes --; } Identify the race condition(s) on the above code segments (5 points). Assume you have a mutex lock named mutex with the operations acquire() and release() (or, equivalently lock() and unlock()). Indicate where the locking operations should be placed in the above code to prevent race condition(s) (5 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
