Devise an algorithm that determines whether or not a system
Devise an algorithm that determines whether or not a system is safe by enumerating all possible states. Is this problem NP-complete? Justify your answer
Solution
we can fix whether the system is safe. This may be computationally infeasible in several subjects, objects, and rights are involved. Result may dose not generalize to all protection systems.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Algorithm for a system safe:
function bank\'s_algorithm(set of processes Q, currently available resources R)
{
while (Q not empty)
{
boolean found = false
for each (process p in Q)
{
Cp = current_resource_allocation_for_process(p)
Mp = max_resource_requirement_for_process(p)
if (Mp - Cp = A)
{
R = R + Cp
remove_element_from_set(p, Q)
found = true
}
}
}
if (not found)
{
return UNSAFE
}
return SAFE
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Created on categories of critical to safety problem’s analysis,
This algorithm is NP-Complete, because Safety problem is undecidable and limiting scope of systems can make problem decidable.
