Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
You can change this under Settings & Account at any time.
tugas SISOP E presentasi DeadLock
Transcript of tugas SISOP E presentasi DeadLock
2. Rollback return to some safe state, restart process for that state
3. Starvation same process may always be picked as victim, include number of rollback in cost factor Safe State Example 1 &2 OPERATING SYSTEM Deadlock Deadlock can arise if four conditions hold simultaneously:
Hold and Wait
Circular Wait Deadlock Prevention METHODS FOR HANDLING DEADLOCKS Ensure that the system will never enter a deadlock state; (use either a deadlock prevention or avoidance)
Allow the system to enter a deadlock state and then recover
Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX. (need to restart the computer if a deadlock occur) System Model (cont.) System Model (cont) OPERATING SYSTEM
Deadlock KEL: 10 Deadlock Characterization Deadlock Prevention Restrain the ways request can be made
Mutual Exclusion – not required for sharable resources; must hold for nonsharable resources. Deadlock Prevention (cont.) Restrain the ways request can be made
Hold and Wait –
must guarantee that whenever a process requests a resource,
it does not hold any other resources.
Require process to request and be allocated all its resources before it begins execution, or allow process to request resources only wheb the process has none.
Low resource utilization; starvation possible. Gifari Reza Pahlevi 5212100152
Aga Aligarh 5212100158
Allan Dharma saputra 5212100159
Mirza Rahmat Suharata 5212105704
Zarrina Muhibah 5212100702 The Deadlock Problem
Method for Handling Deadlocks
Recovery from Deadlock GAMBAR A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example of a deadlock problem:
System has 2 tape drives
Process P1 and process P2 each hold one tape drive and each needs another one. A system consists of a finite number of resources to be distributed among a number of competing processes. Resource types R1, R2,.., Rm
CPU cycles, memory space, I/O devices The resources may be either physical (printers, tape drives, memory space, and CPU cycles) or logical (files and semaphores). A
A The Deadlock problem A set of process is in a deadlock state if each process in the set is waiting for an event that can be caused by only another process in the set. In other words, each member of the set of deadlock processes is waiting for a resource that can be released only by a deadlock process. System Model System Model (con't) A process may utilize a resource in only the following sequence:
Request: If the request cannot be granted immediately, then the requesting process must wait until it can acquire the resource.
Use: The process can operate on the resource (ex., print on printer)
Release: The process releases the resource. A process must request a resource before using it, and must release the resource after using it. The request and release of resources are system calls (examples: request and release device, open and close file, and allocate and free memory system calls). Request and release of other resources can be accomplished through the wait and signal operations on semaphores Restrain the ways request can be made
No Preemption –
If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are released.
Preempted resources are added to the list of resources for which the process is waiting.
Process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting.
Requires that the system has some additional a priori information available.
Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need.
The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition.
Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. Deadlock Avoidance A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock.
System is in safe state if there exists a safe sequence of all processes.
Sequence (P1, P2,.., Pn) is safe if for each Pi, the resources that Pi can still request can be satisfied by currently available resources + resources held by all the Pj, with j<i. Safe State If Pi resource needs are not immediately available, then Pi can wait until all Pj have finished.
When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and terminate.
When Pi terminates, Pj+1 can obtain its needed resources, and so on. Safe staat cont A system with 12 tape drives and 3 processes; P0, P1, P2.
The following table at state T0. At T0 the system is in a safe state, because the sequence (P1, P0, P2) satisfies the state condition. 1. Allow system to enter deadlock state
2. Detection algorithm
3. Recovery scheme Deadlock Detection . Recovery from Deadlock 1. Process Termination
2. Resource Preemption 1. Abort all deadlocked processes
2. Abort one process at a time until deadlock cycle is eliminated
3. In which order should we choose to abort
a. Priorty of the process
b. How long process has computed, and how much longer to completion
c. Resources the process has used
d. Resourcesprocess needs to complete
e. How many processes will need to be terminated
f. Is process interactive or batch Process Termintaion Resources Preemption Restrain the ways request can be made
Circular Wait – impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration Deadlock Prevention cont thanks to: All member of group 10
Our Teacher Mr. Nisfu Asrul Sani
Operating System Concept chapter 8