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!
1. Explain how the magnetosphere of Saturn works. How does it compare with Earth's? How is...
1. Explain how the magnetosphere of Saturn works. How does it compare with Earth's? How is it similar and different? Is it smaller or bigger and by how much? Use diagrams to help illustrate your explanations.
How does the diuretic works?
How does the diuretic works?
how does a bond works?
how does a bond works?
Three types of artificial intelligence. Explain how each works and provide an example on how each...
Three types of artificial intelligence. Explain how each works and provide an example on how each are being used?
Explain why the Floyd algorithm works even if there is negative numbers present in the distance...
Explain why the Floyd algorithm works even if there is negative numbers present in the distance matrix as long as we require there be no negative cycles.
In all algorithm, always explain how and why they work. ALWAYS, analyze the complexity of your...
In all algorithm, always explain how and why they work. ALWAYS, analyze the 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. In all data structures, try to minimize as much as possible the running time of any operation. 1.Show that if a binary tree has a vertex with a single child, then this can not be an optimal Huffman tree. 2. Question...
In a decision tree, how does the algorithm pick the attributes for splitting? Would you explain...
In a decision tree, how does the algorithm pick the attributes for splitting? Would you explain it logically and specifically?
1. What is the purpose of Rete algorithm? Describe how it works. 2. What is a...
1. What is the purpose of Rete algorithm? Describe how it works. 2. What is a linearly separable classification problem? Give one example that is not linearly separable.
Explain Monetary and Fiscal Policies. a) How does contractionary monetary policy works? Explain by graphs (...
Explain Monetary and Fiscal Policies. a) How does contractionary monetary policy works? Explain by graphs ( interest rate, exchange rate, consumption, import, export) b) How does expansionary fiscal policy works? Explain by graphs. ( interest rate, exchange rate, consumption, import, export)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT