# Bankers algorithm - How does it work?

I'm currently studying deadlocks and I'm trying to learn myself the bankers algorithm.

In this example my teacher goes to B first, then C and finally A.

He adds (I think) 2 (row b, Has) with 3 (free) and then gets the new Free value 5. After that he proceeds to row C where he adds 2 (row c, Has) with the free value 5 which gives us a new free value of 7.

After this he goes to the last row A and adds 3 to seven which gives him the free value of 10.

This does not cause a dead lock and I'm wondering why, Isn't he over the Max value of row A?

Here is another example in which the first image is included, but there is also one scenario when we get a dead lock. I don't really understand why since we still get 10 free like the rest of the examples.

Sorry if this is a bit confusing. I can simplify if its needed.

• Don't use images as main content of your post. It makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and maths (note that you can use LaTeX) and don't forget to give proper attribution to your sources! – D.W. Mar 21 '14 at 7:33