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, 23.06.2019 01:10
Problem 1 - hashing we would like to use initials to locate an individual. for instance, mel should locate the person mark e. lehr. note: this is all upper case. generate a hash function for the above using the numbers on your telephone. you know, each letter has a number associated with it, so examine your telephone keypad. generate 512 random 3 letter initials and take statistics on a linked list array size 512 to hold this information report how many have no elements, 1 element, 2 elements, does this agree with the hashing statistics distribution?
Answers: 1
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
question
Computers and Technology, 24.06.2019 11:40
100 pts. first person gets brainliest
Answers: 2
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
English, 14.07.2020 21:01
Questions on the website: 13722367