#4:If a process requests an instance of a resource type, the allocation of any instance of the type should satisfy the request. If it does not, then the instances
are not identical, and the resource type classes have not been defined properly. For example, a system may have two printers. These two printers may be defined to be in the same resource class if no one cares which printer prints which output. However, if one printer is on the ninth floor and the other is in the basement, then people on the ninth floor may not see both printers as equivalent, and separate resource classes may need to be defined for each printer.
A process may request as many resources as it requires to carry out its designated task. Obviously, the number of resources requested may not exceed the total number of resources available in the system.
#5:EXAMPLES
To illustrate a deadlocked state, consider a system with three CD RWdrives.
Suppose each of three processes holds one of these CDRWdrives. If each process
now requests another drive, the three processes will be in a deadlocked state.
Each is waiting for the event “CD RW is released,” which can be caused only
by one of the other waiting processes. This example illustrates a deadlock
involving the same resource type.
Deadlocks may also involve different resource types. For example, consider
a system with one printer and one DVD drive. Suppose that process Pi is holding
the DVD and process Pj is holding the printer. If Pi requests the printer and Pj
requests the DVD drive, a deadlock occurs.
#6:Chapter 5 discussed various synchronization tools, such as mutex locks
and semaphores. These tools are also considered system resources, and they
are a common source of deadlock. However, a lock is typically associated with
protecting a specific data structure—that is, one lock may be used to protect
access to a queue, another to protect access to a linked list, and so forth. For that
reason, each lock is typically assigned its own resource class, and definition is
not a problem.
#10:When process Pi requests an instance of resource type Rj , a request edge
is inserted in the resource-allocation graph. When this request can be fulfilled,
the request edge is instantaneously transformed to an assignment edge. When
the process no longer needs access to the resource, it releases the resource. As
a result, the assignment edge is deleted.
#13:To decide whether the current request can be satisfied or must be delayed, the
system must consider the resources currently available, the resources currently
allocated to each process, and the future requests and releases of each process.
In the absence of algorithms to detect and recover from deadlocks and the deadlock has occure and there is no way of recognizing what has happened
- the undetected deadlock will cause the system’s performance to deteriorate, because resources are being
held by processes that cannot run and because more and more processes, as
they make requests for resources, will enter a deadlocked state. Eventually, the
system will stop functioning and will need to be restarted manually.
#15:To illustrate the difference between these two protocols, we consider a
process that copies data from a DVD drive to a file on disk, sorts the file, and
then prints the results to a printer. If all resources must be requested at the
beginning of the process, then the process must initially request the DVD drive,
disk file, and printer. It will hold the printer for its entire execution, even though
it needs the printer only at the end.
The second method allows the process to request initially only the DVD
drive and disk file. It copies from the DVD drive to the disk and then releases
both the DVD drive and the disk file. The process must then request the disk
file and the printer. After copying the disk file to the printer, it releases these
two resources and terminates.
#16:if a process requests some resources, we first check whether they are available. If they are,
we allocate them. If they are not, we check whether they are allocated to some other process
that is waiting for additional resources. If so, we preempt the desired resources from the waiting
process and allocate them to the requesting process. If the resources are neither available
nor held by a waiting process, the requesting process must wait.
#18:It is also important to note that imposing a lock ordering does not guarantee
deadlock prevention if locks can be acquired dynamically. For example, assume
we have a function that transfers funds between two accounts. To prevent a
race condition, each account has an associated mutex lock that is obtained from
a get lock() function such as shown in Figure 7.5:
#43:In both methods, the system reclaims all resources allocated to the terminated processes.
Aborting a process may not be easy. If the process was in the midst of updating a file, terminating it will leave that file in an incorrect state.
Similarly, if the process was in the midst of printing data on a printer, the system must reset the printer to a correct state before printing the next job.
This determination is a policy decision, similar to CPU-scheduling decisions. The question is basically
an economic one; we should abort those processes whose termination
#45:In a system where victim selection is based primarily on cost factors,
it may happen that the same process is always picked as a victim. As
a result, this process never completes its designated task, a starvation
situation any practical system must address.
Clearly, we must ensure that a process can be picked as a victim only a (small) finite number of
times. The most common solution is to include the number of rollbacks
in the cost factor.