Question: Problem A. Consider the following code example for allocating and releasing, which can be concurrently called by multiple processes to fork new processes #define MAX

 Problem A. Consider the following code example for allocating and releasing,which can be concurrently called by multiple processes to fork new processes#define MAX PROCESSES 255 int number of processes 0; // a shared

Problem A. Consider the following code example for allocating and releasing, which can be concurrently called by multiple processes to fork new processes #define MAX PROCESSES 255 int number of processes 0; // a shared variable /* the implementation of fork ) calls this function */ int allocate process) int new pid; if (number of processesMAX PROCESSES) return -1; allocate necessary process resources; ++number_of_processes; return new pid; else /* the implementation of exit) calls this function */ void release process )i release process resources --number of processes; Using the Semaphore structure in Slide 3.23 to declare & initialize a Semaphore named proc s only being accessed via atomic wait) and signal () operations, which are defined in Slide 3.24 for the input parameter named S. To prevent race condition(s), 1. Write C statements to declare and initialize the Semaphore named proc_s using the Semaphore structure in Slide 3.2:3 2. Re-write the allocate_process ) function to call wait) and/or signal () defined in Slide 3.24 3. Re-write the release _process ) function to call wait) and/or signal ) defined in Slide 3.24

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!