1,215 views
0 votes
0 votes
The banker’s algorithm is being run in a system with $m$ resource classes and $n$ processes. In the limit of large $m$ and $n,$ the number of operations that must be performed to check a state for safety is proportional to $m^{a} n^{b}.$ What are the values of $a$ and $b?$

1 Answer

0 votes
0 votes
Each process has an array(size = m) of resources allocated to it.

Ex: $$P_i = [r_1, r_2, r_3, ...., r_m]$$

To check for a safe state:

In first loop, we may find a process that can be executed with the available resources and this takes O(mn).

In second loop, we have (n-1) processes and time complexity is O((n-1)m).

...

...

In last loop, we need to check for that single process whether it can be executed or not, time complexity = O(m)

So, total time complexity = $$O(m(n+(n-1)+(n-2)+.....+1)) = O(m^1n^2)$$

a = 1, b = 2

Related questions

2 votes
2 votes
0 answers
1
1 votes
1 votes
2 answers
2
admin asked Oct 30, 2019
2,138 views
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:What is the smallest value of x for which this is a sa...
0 votes
0 votes
0 answers
3
0 votes
0 votes
1 answer
4