Construct a resource allocation graph with the following processers and resources, the system consists of four processers P1, P2, P3, and P4 and five resources R1, R2, R3, R4, and R5 with the instances 2, 1, 3, 1, and 4 respectively.
Processer P1 holds R2 and requested for R1.
Processer P2 holds R1 and R4 and requested for R2 and R3.
Processer P3 holds R3 and requested for R4 and R5.
Processer P4 holds nothing and requested for R3 and R5.
Check the given system state is safe or deadlock?