Question

In: Computer Science

Explain how does Baker’s algorithm works? Explain all the types of pointers it has and their...

  1. Explain how does Baker’s algorithm works? Explain all the types of pointers it has and their complete functions. [25 points]

Solutions

Expert Solution

Banker's algorithm:

The Banker's algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources, then makes a "S-state" check to test for possible activities, before deciding whether allocation should be allowed to continue.

WORKING PROCEDURE:

It checks if allocation of any resource will lead to deadlock or not,or is it safe to allocate a resource to a process and if not then resource is not allocated to that process. Banker's algorithm is generally used to find if a safe sequence exists or not. But here we will determine the total number of safe sequences and print all the safe sequences. Determining a safe sequence (even if there is only 1) will assure that system will not go into deadlock.

FUNCTIONS & POINTERS :

The important notations used in Banker's algorithm are

Available

Max

Allocation

Need

Let 'n' be the number of processes in the system and 'm' be the number of resource types.

1.Available:

  • It is a 1-D array of size 'm' indicating the number of available resources of each type.
  • Available [ j ] =k means there are 'k' instances of resource type Rj .

2.Max :

  • It is a 2-D array of size 'n*m' that defines the maximum demand of each process in a system.
  • Max[ i,j ] = k means process Pi  may request at most 'k' instances of resource type Rj.

3.Allocation:

  • It is a 2-D array of size 'n*m' that defines the number of resources of each type currently allocated to each process.
  • Allocation [ i ,j]= k means process Pi is currently allocated 'k ' instances of resource type Rj.

​​​​​​​4.Need:

  • It is a 2-D array of size 'n*m' that Indicates the remaining resources need of each process.
  • Need [i ,j]=k means process Pi currently need 'k ' instances of resource type Rj for its execution.
  • Need [i ,j] = Max [i,j] - Allocation [i,j].

Allocation​​​​​​i specifies the resources currently allocated to process Pi  

and Needi specifispecifies the additional resources that process Pi may still request to complete its task.

Banker's algorithm consists of Safety algorithm and Resource request algorithm.


Related Solutions

Explain how depreciation works. I want to know about all the types and a description of...
Explain how depreciation works. I want to know about all the types and a description of the types and WHY you might use them in different situations. Make sure you explain about the years of life associated with depreciation. Be detailed. You could write pages on this!
What is clustering? Explain how K-Means Clustering Algorithm works? What are the Advantages and disadvantages of...
What is clustering? Explain how K-Means Clustering Algorithm works? What are the Advantages and disadvantages of Clustering ALgorithms discussed in our class (K-Means,Hierchal)? Which Clustering Algorithm is better K-Means or hierarchical Clustering? Explain with a proper example which is better algorithm?
Q1. In all algorithm, always explain how and why they work. If not by a proof,...
Q1. In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. Do not write a program. Write pseudo codes or explain in words. (A) Find an efficient data structure supporting the following operations. Insert(S, x), Delete−Max(S), and Delete−100'th(S) which deletes from H the 100 largest element in the structure. Assume that the number of elements is more than 100. Also...
Remarks: In all algorithm, always explain how and why they work. If not by proof, at...
Remarks: In all algorithm, always explain how and why they work. If not by proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with a slow running time may not get full credit. Do not write a program. Write pseudo-codes or explain in words Question 1: Say that we want to maintain both a Queue and a Priority Queue. This...
Remarks: In all algorithm, always explain how and why they work. If not by a proof,...
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words Question 3: Give a data structure that implements a Min-Heap and the command M ax(S)...
Remarks: In all algorithm, always explain how and why they work. If not by a proof,...
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words Question 2: 1. Show how to implement a Queue by a Priority Queue. What is...
Remarks: In all algorithm, always explain how and why they work. If not by a proof,...
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words Question 1: Say that we want to maintain both a Queue and a Priority Queue....
Remarks: In all algorithm, always explain how and why they work. If not by a proof,...
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words Question 4: Recall the problem in which you have k sorted array each of size...
Remarks: In all algorithm, always explain how and why they work. If not by a proof,...
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words Question 5: Five an efficient data structure supporting the following operations. Insert(S, x), Delete−M ax(S),...
What is a growth function? How does it relate to the efficiency of an algorithm? Explain...
What is a growth function? How does it relate to the efficiency of an algorithm? Explain with example.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT