Computers and Technology, 14.11.2019 20:31, Briii582
Assume that a finite number of resources of a single resource type must be managed. processes may ask for a number of these resources and —once finished—will return them. as an example, many commercial software packages provide a given number of licenses, indicating the number of applications that may run concurrently. when the applicationis started, the license count is decremented. when the application is terminated, the license count is incremented. if all licenses are in use, requests to start the application are denied. such requests will only be granted when an existing license holder terminates the application and a license is returned. the following program segment is used to manage a finite number of instances of an available resource. the maximum number of resources and the number of available resources are declared as follows: #define max resources 5int available resources = max resources; when a process wishes to obtain a number of resources, it invokes the decrease_count() function: /* decrease available resources by count resources *//* return 0 if sufficient resources available, *//* otherwise return -1 */int decrease_count(int count) {if (available resources < count)return -1; else {available resources -= count; return 0; }}when a process wants to return a number of resources, it calls the increase_count() function: /* increase available resources by count */int increase_count(int count) {available resources += count; return 0; }the preceding program segment produces a race condition. do the following: identify the location and variables involved in the race condition and use a semaphore to fix the race condition.
Answers: 1
Computers and Technology, 28.06.2019 10:10, zhp7171
Answers: 2
Health, 07.07.2019 10:00, kittykat7315
Answers: 2
Biology, 30.07.2019 21:00, gray4675
Answers: 2
Business, 01.10.2019 20:20, caguil00
Answers: 3
Assume that a finite number of resources of a single resource type must be managed. processes may as...
Social Studies, 05.05.2020 08:23
History, 05.05.2020 08:23
History, 05.05.2020 08:23