subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
Least square fit to polynomial write a function leastsquarefit3pol that solves a linear system of equations to find a least squares fit of a third order polynomial to an experimental data set given as two row arrays. the function leastsquarefit3pol must explicitly solve a set of linear equations and cannot use polyfit. there should be no restriction on the size of the problem that can be solved.
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Which tab is used to change the theme of a photo album slide show? a. design b. view c. transitions d. home
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Using the list, you can select the number of photos that will appear on each slide. a. theme b. frame shape c. pictures in album d. picture layout
Answers: 1
You know the right answer?
Assume that a finite number of resources of a single resource type must be managed. processes may as...
Questions
question
Mathematics, 19.12.2019 23:31
Questions on the website: 13722362