DEADLOCKS.ppt EDITED

Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

DEADLOCKS:

DEADLOCKS BY: ANGELICA B. ROBERTO BSIT2D-G1

DEADLOCK CONCEPT:

DEADLOCK CONCEPT A process usually changes state and one of the state is the WAITING STATE . A process requests, resources; if the resources are not available at that time, the process enters a wait state.

DEADLOCK CONCEPT:

DEADLOCK CONCEPT WHAT IS A DEADLOCK SITUATION? If a process remains in the waiting state and never changes its state, the process is said to be in a deadlock situation. DEADLOCK -deadly embrace

DEADLOCK CONCEPT:

DEADLOCK CONCEPT -a situation which two or more processes are unknowingly waiting for the resources that re held by each other and thus unavailable. RESOURCES -are devices or parts of the computer system, from the input stage, processing stage up to the output stage that process passes through in order to accomplish its task.

DEADLOCK CONCEPT:

DEADLOCK CONCEPT EX: I/O devices like printer, monitors, etc. Non-I/O devices like memory and CPU. it is important to note that if the process requests for an instance of a resource type, then the allocation of any instance of that type will satisfy the process need. A process utilizes resources in the following manner:

DEADLOCK CONCEPT:

DEADLOCK CONCEPT REQUEST -if the OS grants the request, the process may hold on the resource, otherwise it waits. USE -the process avails of the resource to perform execution. Note that all request for a resource must be granted first before it can be employed in process execution.

DEADLOCK CONCEPT:

DEADLOCK CONCEPT RELEASE -as soon as the process is done with the device or resource it is freed, in order for other process to make use of the resource. CONDITION FOR DEADLOCK the four conditions for deadlock must be present in order for process to be considered in deadlock mode. The following conditions are:

CONDITIONS FOR DEADLOCK:

CONDITIONS FOR DEADLOCK MUTUAL EXCLUSION CONDITION -occurs when at least one resource is held in a non-shareable mode. In other words, a process has a monopoly or exclusivity over a particular resource. 2. HOLD AND WAIT CONDITION -occurs when a process is continuously holding to a resources while it is waiting for another resource held by another process. The process would not release the instance of the resource unless it gets the resource it is requesting from other program.

CONDITIONS FOR DEADLOCK:

CONDITIONS FOR DEADLOCK 3. NO PREEMPTION CONDITION -occurs when a process cannot be temporarily suspended. Resources previously granted for a process cannot be forcibly taken away. They must be explicitly released by the process. 4. CIRCULAR WAIT CONDITION -occurs when a particular chain of two or more processes each of which are waiting for a resource held by the next member of the chain.5

APPROACHES TO DEADLOCK HANDLING:

APPROACHES TO DEADLOCK HANDLING There are three common approaches to handle deadlocks. These are the following: IGNORE DEADLOCK -this is the most common approach. If the deadlock occurs then just reboot or kill the process in question. This is okay if the deadlock is not frequent and rebooting or killing the process is possible.

APPROACHES TO DEADLOCK HANDLING:

APPROACHES TO DEADLOCK HANDLING 2. DEADLOCK DETECTION -this approach detects or finds the source of the deadlock in order to fix it. This is very costly and must periodically scan the resource allocation graph for cycles. 3. DEADLOCK PREVENTION -this approach is evasive. It tries to avoid the possibility of deadlocks by controlling the requests for resource.

DEADLOCK PREVENTION:

DEADLOCK PREVENTION Deadlocks can be prevented by never allowing at least one of the deadlock conditions to be true. This may sound simple but in terms of implementation it may cause a lot of problems than solutions. There resources that cannot be shared unless direct access is not required the use of spooling in the printer, however, allows multiple jobs to fall in line the printer. This may look like it is being held by many

DEADLOCK PREVENTION:

DEADLOCK PREVENTION process at a given time and somehow eliminate mutual exclusion. However, this case is not true for a magnetic tape which can only accommodate one process request at a time. Thus, mutual exclusion cannot be eliminated in most cases. The hold and wait condition will not work if only those processes without any resource can make actual resource requests. One strategy is to make a process request all of the

DEADLOCK PREVENTION:

DEADLOCK PREVENTION request all the resources it will need before it begins execution. The problem with this hold and wait prevention strategy the process would not know in advance all of the resources it will need throughout its execution. Another strategy is to make all process release the resource they hold in the occurrence of the request. This strategy somehow implies that resources should be released so that it can be snatched

DEADLOCK PREVENTION:

DEADLOCK PREVENTION away by the process which made the request. This also impractical. Addressing a non-preemption condition is even more impractical than eliminating mutual exclusion. In order for a preemption to occur the device must be capable of saving its state like in interrupt, otherwise its status would be lost. Eliminating the circular-wait condition is the most compromising among all deadlock prevention strategies.

DEADLOCK PREVENTION:

DEADLOCK PREVENTION The idea is to use the priority resources so that any resource can be requested. In this strategy , resources with lower priorities with other resources would have to be released once requested by a higher priority process.

illustrations:

illustrations A P1 A P1 B P2 P1 A

Illustrations:

Illustrations P1 P3 P2 R1 R2 R3

authorStream Live Help