Banker's Algorithm Question | Operating System - M04 P06

Banker's Algorithm Question | Operating System - M04 P06

This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the forth module which consists of 8 articles.

In this article we will see a question on banker’s algorithm, to get better understanding of the concept.

Question: Check for the deadlock, if deadlock is not present then find the safe sequence.

Process No.Allocation of EAllocation of FAllocation of GMax need of EMax need of FMax need of GCurrent availability of ECurrent availability of FCurrent availability of GRemaining need of ERemaining need of FRemaining need of G
P1101431330330
P2112214431102
P3103133534030
P4200541646341

Answer:

  • Current availability: (3,3,0)
  • With the current availability we can fulfill the request of P0
  • Current availability: (4,3,1)
  • With current availability we can fulfill the request of P2
  • Current availability: (5,3,4)
  • With current availability we can fulfill the request of P1
  • Current availability: (6,4,6)
  • With current availability we can fulfill the request of P3
  • Safe sequence = P0 -> P2 -> P1 -> P3
  • No deadlock will occur. Therefore it is safe.

So this was a question on banker’s algorithm. Hope you liked it and learned something new from it.

If you have any doubt, question, queries related to this topic or just want to share something with me, than please feel free to contact me.

📱 Contact Me

Twitter, LinkedIn, Telegram, Instagram,

📧 Write a mail

rahulmishra102000@gmail.com

GitHub, HackerRank