0

I am trying to understand how a banker's algorithm works. I have an example of how it works on my university slides, but I am not sure why one of processes (in my case P4) has been skipped. Should it not be checked like this at this point? Did I misunderstand something?

 P4 [3,2,2,3] <= [4,4,2,3]

My answer:

enter image description here

Answer from university slides:

Answer from uni slide

Anatolii
  • 11,658
  • 3
  • 27
  • 51
c398wwsfa
  • 21
  • 5

1 Answers1

0

You're right, it should be part of the sequence and it will. It looks like your university slides only show the first step in the banking algorithm. That's why there's a comma after P3 (screenshot from your slide):

enter image description here

As you noted already, once P3 completes, the system will have more than enough resources to offer to P4 because the availability vector will be updated as below:

A B C D
Available 3+1 3+1 0+2 2+1

And what P4 will need is as follows:

enter image description here

You can obviously continue this sequence because after P4 completes, P0 may request resources and get approved too and so on.

Anatolii
  • 11,658
  • 3
  • 27
  • 51