A system that uses Banker's Deadlock Avoidance algorithm has five processes P1, P2, P3, P4, and P5 and uses resources of four different types A, B, C, and D. There are multiple instances of each resource type. Answer the following questions:
Allocation Matrix
P1 1 0 2 0
P2 0 3 1 2
P3 2 4 5 1
P4 3 0 0 6
P5 4 2 1 3
Max Matrix
P1 3 2 4 2
P2 3 5 1 2
P3 2 7 7 5
P4 5 5 0 8
P5 6 2 1 4
Available 3 4 0
D. Write an algorithm to implement the Banker Deadlock method, the input should be allocation matrix, max matrix, and available. The output should be a sequence of safe state or unsafe state.