Need Answer for this question!!! Thank you so much. This is the concurrent progr
ID: 3595690 • Letter: N
Question
Need Answer for this question!!! Thank you so much. This is the concurrent programming question. Please obey the rules. I really need learn this to pass my midterm. Thank you
The local laundromat has just entered the computer age. As each customer enters, he or she puts coins into slots at one of two stations and types in the number of washing machines he/she will need. The stations are connected to a central computer that automatically assigns available machines and outputs tokens that identify the machines to be used. The customer puts laundry into the machines and inserts each token into the machine indicated on the token. When a machine finishes its cycle, it informs the computer that it is available again. The computer maintains An array available[NMACHINES] whose elements are non-zero if the corresponding machines are available (NMACHINES is a constant indicating how many machines are there in the laundromat) Using semaphores, write the code to allocate and release the machines. Assume that the available array is initialized to all ones. You are free to use as man solution. Please specify the initial values of the semaphores and/or any global variables used in your solution. y semaphores and other variables as needed for your /* Specify initial values below */ int allocate0 /* returns index of available machine */ release(int machine) /* releases machine */