You are on page 1of 5

‫جمهورية العراق‬

‫وزارة التعليــم العـــالي والبحث العـلمي‬


‫كلية بغداد للعلوم االقتصادية الجامعة‬
‫قسم علوم الحاسبات‬

‫‪Process States - Deadlock‬‬


‫‪Deadlock Prevention‬‬

‫تقرير مقدم الى قسم علوم الحاسبات ‪ /‬كلية بغداد للعلوم االقتصادية الجامعة‬

‫إعداد الطالبة‬
‫كوثر عباس جاسم محمد‬

‫اسم المادة‬
‫نظم التشغيل‬

‫‪ 2020‬م‬
Abstract

Sharing and allocating system resources between running and new


processes is an operating system task. In a multiprocessing environment,
allocation of resources can become a point of conflict. Such conflict may lead
the system into a state known as deadlock. The scope of the topic is to the
method for prevention. Deadlock is one of the canonical problems in distributed
systems. It arises naturally in distributed systems such as distributed databases,
distributed operating systems and store and forward networks. In these systems,
the data reside at multiple distributed locations, and the processes have to
collaborate in order to perform a task. Deadlock is characterized by a set of
processes that are waiting for resources held by other processes in the set
indefinitely. It reduces the throughput and resource availability in distributed
systems. It can be handled through three ways, namely: deadlock prevention,
deadlock avoidance and deadlock detection. The suitability of a specific
deadlock handling approach highly depends on the application and
environment. Deadlock prevention and avoidance are impractical or inefficient
and relatively expensive as compared to deadlock detection approach in
distributed systems. In Deadlock detection, the process resource interactions are
examined to determine deadlocks.

Figure 1 Deadlock State


1.1 Introduction

Deadlock prevention in sequential resource allocation system is a well-


defined problem in flexible manufacturing systems (FMS’s). In an FMS, raw
parts of various types enter the system and are processed concurrently. While
sharing a finite number of resources, such as robots, machines and vehicles,
each part has a particular operation flow that determines the order in which
resources must be assigned to the part. However, the complex operation
processes in an FMS are executed concurrently and they have to compete for a
finite set of resources. These relations of competition might cause the system to
be deadlocked. Generally speaking, a deadlock occurs in an FMS when parts are
blocked waiting for shared resources held by others that will never be granted.
From a theoretical viewpoint, the problem arises in any resource sharing FMS
where a set of concurrently executing sequential processes can block the
system’s evolution because each process is allocated and holds resource(s)
requested by some other process for its further advancement.[1]

1.2 Methods for Handling Deadlocks

To ensure that deadlocks never occur, a system can use either deadlock
avoidance or deadlock prevention (our topic goal)

1. Deadlock Avoidance - requires that the operating system be given


comprehensive information about which resources a process will request
during its lifetime.
2. Deadlock Prevention- ensures that at least one of the four necessary
conditions for deadlock cannot hold.
1.3 Deadlock Prevention

Deadlocks are an undesirable system state and their prevention or detection and
recovery, if unavoidable, is necessary. Various methods and approaches exist
surprisingly, there are operating systems that ignore the issue altogether; in
those situations, deadlock detection and recovery becomes the primary focus
Predicting potential deadlock conditions can be complex, but there are some
general conditions that if true, make deadlocks inevitable.[2] Namely, if all of
the following conditions are present:

 a mutual exclusion condition,


 no preemption condition,
 ahold-and-wait condition
 a circular-wait condition

For the more “proactive” operating systems, some solutions have been proposed
to provide some type of deadlock prevention mechanism.

One solution is by forcing processes to “carry” information about the


type, amount and order in which they will utilize resources and only then, with a
scheduling algorithm, allow processes to run ensuring that deadlock possibilities
are eliminated. Further, prevention can also be accomplished by enforcing a
strict scheduling algorithm for directing processes on acquiring resources in a
specific order. The advantage of these last two deadlock prevention methods is
almost guaranteed progress, but both bare the disadvantage of tremendous
system overhead to enforce the scheduling algorithms and substantial execution
performance inefficiencies. That can ensure that only one process reside within
one monitor. They provide an inherent full-proof mutual exclusion mechanism,
but do not provide synchronization mechanisms on their own. To overcome this
shortcoming, monitors are usually complemented by some type of a semaphore
implementation. [3]
REFERENCES

[1] Silberschatz, Abraham, Peter B. Galvin, and Greg Gagne. "Operating system
concepts, Hoboken." (2013).

[2] Coffman, E.G., Elphick, M.J., Shoshani, A. (1971) System Deadlocks


Computing Surveys, 3(2), pp. 67- 78, June 1971.

[3] Tanenbaum, A. S. (1992). Modern Operating Systems. Englewood Cliffs,


NJ: Prentice Hall.

You might also like