OPERATING SYSTEM CONCEPTS
Dhotre, I. (2009). Operating Systems. Technical Publications.
In his book title “Operating systems” Dhotre explains the designs and processes that determine the existence of deadlock. One of the solutions developed in this situation is to let the operator know of the existence of a deadlock and employ manual recovery methods. He continues to outline the automatic recovery methods. In general, the author has outlines two mechanisms for total recovery from deadlock. First, one or more processes are aborted to break the cycle of waiting. Secondly, the preemptive mechanism done on one or more of the deadlocked processes will release the resources. The first sub-section of the book describes the process termination techniques utilized to release resources allocated to a terminating process. These include the breaking of the deadlock cycle of the partial computations and subsequently discarding the results for a future re-calculation. Another viable method include the termination of a process at a time until the deadlock cycle is eliminated. There is considerable overhead associated with this process since the deadlock-detection algorithm must be invoked each time to determine if a deadlock is still in existence or not. The method of terminating a process is costly and insufficient and sometimes leaves the process in an incorrect state. For instance in the process of updating a file, termination will lead to incomplete and incorrect state. In the same breadth, if the process involved the printing of data, the printer must be reset to the correct state before the next job can be printed. In this literature, the termination is classified as partial and complete. Partial termination considers the deadlock processes that need to be terminated through a policy mechanism synonymous with the CPU-scheduling decisions. It resolves to terminate the processes with the least minimum cost. Some factors will determine which process qualifies to cause minimum disruption according to the following; First, priority of the process is determined and the period the process has computed as well as the remaining time to complete the task. Secondly, the author discusses on the many types of resources the process has utilized and much of them are still required to complete the process. Lastly, the literature investigates the number of processes that need to be terminated, and whether the processes are interactive or batch.
The next subsection of the book discusses the resource preemption mechanism as a solution to the deadlock. This is done by preempting some resources from some processes and allocating them to other processes until a [point where the deadlock cycle is broken. This is done in a number of ways. First, the victim selection process is done through determination of which processes are to be preempted. The order of preemption is fundamental in order to achieve the least cost principle. This is depended on the number of resources tied up in a deadlock process and the amount of time the processes has taken in this mode. The strategy is the determination of the rollback mechanism where the resource preempted from a process is studied and the process rolled back to some safe state that is capable of being restarted again. The challenge, however, occurs when the safe state cannot be correctly determined and the author advises a total roll back for such a scenario. In short, as the author explains, the process involves aborting
Sharma, D. P. (2009). Foundation of Operating Systems. Excel Books India.
The book written by Sharma D. P “Foundation of the operating system” studies a system that does not employ either a system deadlock-prevention nor deadlock-avoidance algorithm. This system is more probable to enter in a deadlock. The author elaborates two mechanisms for the detection and recovery from a deadlock. The literature explains these mechanisms in a single instance of each resource and multiple instances of the resource types. The author uses the model of a wait-for graph for the single instance. The discussion involves the use of time varying data structures and the literature go on to give an example of a bankers algorithm. In this book, factors such as available, allocation and request are defined in the form of a matrix. The relationship between them is probed. The allocation and resource variables are treated as vectors, and a detection algorithm is used to investigate every single and possible instance of allocation sequence that completes the processes. The author gives the example of a bankers algorithm that is used by banks to allocate resources to its customers in a manner that will satisfy all the customers. This is possible through a declaration of the maximum number of resources a process would require of each resource type. The mechanism works by comparing the requested resources and the state of the system after allocation. The rule behind this mechanism is that, at every instance, the system must be left in a safe mode with sufficient resources all the time. The author outlines the data structures that must be implemented in order to attain a successful banker’s algorithm. This includes available, max, allocation and need. All these data structures have different sizes and value and are represented in a matrix form. The literature goes into deep detail to discuss and illustrate the attainment of safety algorithm for such a scenario and the resource-request algorithm. In summary, the book describes the conditions necessary for deadlock; the processes include two or more processes waiting indefinitely for another event that can be initiated only by the waiting process. It also highlights the general methods of preventing deadlock including use of preventive protocol, detection and recovery methods and despise and see strategies.
Abraham Silberschatz, P. B. (2008). Operating System Concepts. Wiley.
In this book Abraham Silberschatz, Peter B. Galvin and Greg Gagne explores the fundamental concepts and algorithms of operating systems in a general format that is not tied to a single OS. The book presents a number of examples that pertain the most innovative and common operating systems such as Sun Microsystems, Linux, Microsoft Windows Vista, Windows 2000, Windows XP and Apple Mac OSX.
In chapter seven of the book, Abraham Silberschatz et.al discusses the several processes that contribute to competition for a number of resources in a multi programming environment. A process that request resources will enter into waiting state if the resources are not available at the moment. In some instances, the waiting process is kept in that mode infinity because another process is holding on to the requested resources. Thus, Abraham Silberschatz et al termed that scenario as deadlock. The chapter starts with an example of a Kansas legislature in the 20th century that that illustrates an example of two trains approaching each other at a crossing and both of them come to a stop and neither will start until the other has gone.
The chapter goes on to describe the methods an operating system can utilize to prevent deadlock. It cites the fact that operating systems have no capability to prevent deadlock and thus, programmers are posed with the challenge of designing deadlock free applications. Deadlock problems are more common in respect to current trends that include numerous processes, multithread programs and many resources within a system. Also, the desire to have a long-lived file and database servers other than batched systems is a contributing factor for deadlock.
The methods that the operating system uses to prevent and deal with deadlock when it happens are identified in the chapter. The first section describes a system model comprising of a finite number of resources that are shared between a numbers of rival processes. The resources are divided into different types comprising of memory space, CPU cycles, I.O devices and files. A process must automatically request a resource, use it and release it after using it. The number of resources available cannot, however, be in excess of the available resources.
Generally, a process will utilize resources based on the following sequence; The process request a resource and if it is not available immediately, it then has to wait in the waiting mode until it acquires it. The process then utilizes the resource to perform an operation and finally release it after execution of the intended operation. Each and every process in the group is waiting for an event that can be caused by another process, deadlock happens. This affects resource allocation and release. These resources may either be physical, logical or both. The next subsection discusses the characteristics of dreadlock and classify into four; mutual exclusion, hold and wait, no preemption and circular wait. The book continues to discuss and highlight resource allocation graphs with and without deadlock. It Describes the system resource allocation graph as containing a set of vertices of two different types of nodes; P=(p1, ..pn) and R= (r1,r2, ..rn).
Garrido, J. M. (2010). Performance Modeling of Operating Systems Using Object-Oriented Simulation:. Springer.
Garido Jose M in his book “Performance Modeling of Operating Systems using Object-oriented Simulation” describes the methods of handling deadlocks through any of the steps outlined below. A protocol is used to prevent or avoid deadlocks to guard the system into entering into a deadlock state. Secondly, Jose highlighted the practice of allowing the system to enter into deadlock and thereafter detecting it and recovering it. Finally, all thing can be ignored by assuming that nothing happened. This rule is widely used by many operating systems such as Windows and Unix. This is founded on the application developers to come up with applications that are deadlock free or can handle deadlock. The book recognizes that none of the three approaches is appropriate for the entire spectrum of the processes of resource allocation and control in the operating systems. Therefore, it adopts two essential mechanisms to ensure that deadlock does not occur in the first place. This includes deadlock prevention and deadlock avoidance. Deadlock prevention has to do with the set of procedures and mechanisms that ensure that no one of the necessary conditions exist. This is achieved by constraining the method of sending a request.
In deadlock avoidance, the book focuses on the methods of giving the operating system additional information concerning the resources that will be used in its operation. Through this process, the operating system decides which operations or request that the process should wait. This decision is based on currently available resources, its allocation mechanisms to the processes and the possible future releases of each process. Another viable method include the termination of a process at a time until the deadlock cycle is eliminated. There is considerable overhead associated with this process since the deadlock-detection algorithm must be invoked each time to determine if a deadlock is still in existence or not. The method of terminating a process is costly and insufficient and sometimes leaves the process in an incorrect state. For instance in the process of updating a file, termination will lead to incomplete and incorrect state. In the same breadth, if the process involved the printing of data, the printer must be reset to the correct state before the next job can be printed. In this literature, the termination is classified as partial and complete. Partial termination considers the deadlock processes that need to be terminated through a policy mechanism synonymous with the CPU-scheduling decisions. It resolves to terminate the processes with the least minimum cost. Some factors will determine which process qualifies to cause minimum disruption according to the following; First, priority of the process is determined and the period the process has computed as well as the remaining time to complete the task. Secondly, the author discusses on the many types of resources the process has utilized and much of them are still required to complete the process. Lastly, the literature investigates the number of processes that need to be terminated, and whether the processes are interactive or batch.
The book further continues to highlight the scenarios that may happen in case a system goes into deadlock. A lack of deadlock-prevention and deadlock-avoidance mechanism implies that the system may utilize an algorithm to check on the state of the system and determine if it has gone into deadlock or not. However in the absence of the capability to detect the state of the system to check its state and thereby its performance will be impacted. The deterioration of the performance may be explained by the fact that resources are held by processes that are not able to run while more and more processes are concurrently making request. The system will finally stop working and need to be restarted manually. This method is not a viable solution to the deadlock problem but is nevertheless used in most operating system. Compared to deadlock-prevention, deadlock avoidance, and deadlock detection, the book cites this method as the most favorable and cheap in some instances. An example is given where a real-time process running on a non-preemptive scheduler and not returning control to the OS provides for manual recovery techniques to reset the deadlock process.
Gill, P. S. (2006). Operating System Concepts. Laxmi Publications.
In his book, “Operating System Concepts” Gill P. S describes deadlock avoidance as the mechanisms in which requests made are restrained in a manner to ensure that one of the necessary conditions for deadlock is restricted from happening. The methods are, nevertheless, blamed for system under-utilization and reduced throughput. A model developed in this book probes the additional information on how resources are requested by different processes. By knowing a complete sequence of making requests for each an individual process, the system can decide for each request whether or not to dictate which process should wait in order to deviate from a possible clash. The book continues to outline the simplest algorithm that utilizes the approach to determine the maximum resources that can be requested by each type of process. Thus using these methods enables developers to construct and algorithm that prevents the system from deadlocking. This process works by determining the resource-allocation mechanism to prevent the system from a circular-wait condition which in most cases is the entry point of deadlock.
Breecher, J. (2011, February 20). Operating system safe modes. Operating systems. Retrieved May 05, 2013 from: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CD4QFjAB&url=http%3A%2F%2Fweb.cs.wpi.edu%2F~cs3013%2Fc07%2Flectures%2FSection07-Deadlocks.pdf&ei=wv-FUefxFYeZhQfsgoCoDg&usg=AFQjCNFPjnVuCKqy54CJLWz4e_CgHFG56g&sig2=rIYhet7vkccyhtyiWmX34g&bvm=bv.45960087,d.ZG4
Jerry Breecher in his article continues to describe a safe-state. This is the state that a system allocates resources to each an individual process in an orderly manner to avoid the existence of deadlocks. A certain sequence process described as < p1,p2,p3, .pn> is described in the book as the safe mode where for each Pi the resource allocated to it can make up the available resources held by Pj with a condition that j< i. If the resources cannot be immediately allocated then, Pi is kept in the waiting mode until all the Pj have finished their operations and ultimately release the needed resources. Thus, the book describes the sequence in which Pi must terminate in order for Pi+1 to obtain the resources. A contrary state is known as unsafe state and can result as of lack of algorithm or order for the allocation of resources. However, the exception is not all unsafe modes are deadlock. The operating system lacks the capacity to control the processes of requesting the resources, and as such, the behavior of the processes determine if the unsafe state may proceed to deadlock or not.
The last section of the chapter in this book is described by the author as concerning the resource-allocation graph and the introduction pod a new edge referred to and claim edge. This is, in addition the request and assignment, edges introduced in the chapter. The only difference is that the resource is represented by a dotted line on the graph and is converted to a request edge once a resource Rj is released by PJ.The author describes the process by which this resource can be allocated priority status by defining all the associated processes with process Pi and only granting the request if the assignment edge Ri -PJ does not lead to a cycle of resource-allocation graph. A cycle detection algorithm is implemented to check this status and allow the departure of resources in a safe mode. Otherwise, the presence of a cycle spelt’s an unsafe mode and thus, will prompt Pi to wait for the pending request to be completed
the process and restarting it again. This may not be economical with the system since it has to track and keep all the information regarding the state of all processes.
The last solution provided by the author in this book is called starvation. This method probes the circumstances under which preemption is guaranteed not to originate from the same process. This might arise in systems that select the victim primarily based on the economic factors. As a result, the process never completes its intended task and starvation scenario occurs where the process is picked more often than other processes. The author provides the rule of thumb as picking only a process a finite and possibly small number of times. Thus, a common phenomenon given in this literature is to include a number of rollbacks in the cost factor and determine the most favorable process to select.
References
Abraham Silberschatz, P. B. (2008). Operating System Concepts. London: Wiley.
Breecher, J. (2011, February 20). Operating system safe modes. Operating systems. Retrieved May 05, 2013 from: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CD4QFjAB&url=http%3A%2F%2Fweb.cs.wpi.edu%2F~cs3013%2Fc07%2Flectures%2FSection07-Deadlocks.pdf&ei=wv-FUefxFYeZhQfsgoCoDg&usg=AFQjCNFPjnVuCKqy54CJLWz4e_CgHFG56g&sig2=rIYhet7vkccyhtyiWmX34g&bvm=bv.45960087,d.ZG4
Dhotre, I. (2009). Operating Systems. New York: Technical Publications.
Garrido, J. M. (2010). Performance Modeling of Operating Systems Using Object-Oriented Simulation. New York: Springer.
Gill, P. S. (2006). Operating System Concepts. New York: Laxmi Publications.
Sharma, D. P. (2009). Foundation of Operating Systems. New Delhi: Excel Books India.