I have seen examples about Banker's Algorithm
from this Wikipedia link, this book and many other places. In all these examples some processes are allocated resources less than their Max Need.
For example, consider the state of system as shown in below given image taken from Wikipedia link:
Here you can see that the process P1's Max Need is 3 3 2 2
and the total available resources are 6 5 7 6
. But the system allocates 1 2 2 1
resources to P1. Although it could allocate all the requested resources to P1 and P1 would have completed.
So my questions are:
- Why does the system allocate partial / incomplete resources even when it has the resources available
- If the allocation of partial / incomplete resources is allowed, then why does the system / algorithm enforce that the number of requested / needed resources should be less than the available resources (at the time of request)?. The system could allocate some resources (available at the time of request) to process(es) and the remaining would have been assigned when released by other processes.
OR
The process has to tell the number of resource types (and their instances) in advance, but does not need to be assigned all resources at a time; rather it is assigned resources when actually needed?
Please correct me if I am wrong.