SlideShare a Scribd company logo
1 of 15
Download to read offline
Lecture 6

                   Deadlocks (Cont.d)
                 6.1. Deadlock avoidance
                 6.2. Deadlock prevention
                 6.3. Other issues




Sistem Operasi              http://fasilkom.narotama.ac.id/
                                                              1
Deadlock Avoidance
                      Resource Trajectories




                 Two process resource trajectories
Sistem Operasi            http://fasilkom.narotama.ac.id/
                                                            2
Safe and Unsafe States (1)




   (a)           (b)               (c)                   (d)   (e)




     Demonstration that the state in (a) is safe

Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                                     3
Safe and Unsafe States (2)




 (a)             (b)                                     (c)   (d)



Demonstration that the sate in b is not safe

Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                                     4
The Banker's Algorithm for a Single Resource




    (a)                                  (b)                (c)


                 • Three resource allocation states
                    – safe
                    – safe
Sistem Operasi
                    – unsafe
                          http://fasilkom.narotama.ac.id/
                                                                  5
Banker's Algorithm for Multiple Resources




   Example of banker's algorithm with multiple resources
Sistem Operasi     http://fasilkom.narotama.ac.id/
                                                           6
Deadlock Prevention
         Attacking the Mutual Exclusion Condition

• Some devices (such as printer) can be spooled
     – only the printer daemon uses printer resource
     – thus deadlock for printer eliminated
• Not all devices can be spooled
• Principle:
     – avoid assigning resource when not absolutely
       necessary
     – as few processes as possible actually claim the
       resource

Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                         7
Attacking the Hold and Wait Condition

• Require processes to request resources before starting
   – a process never has to wait for what it needs

• Problems
   – may not know required resources at start of run
   – also ties up resources other processes could be using

• Variation:
   – process must give up all resources
   – then request all immediately needed

  Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                             8
Attacking the No Preemption Condition


• This is not a viable option
• Consider a process given the printer
  – halfway through its job
  – now forcibly take away printer
  – !!??




  Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                      9
Attacking the Circular Wait Condition (1)




            (a)                                            (b)


                  • Normally ordered resources
                  • A resource graph

Sistem Operasi           http://fasilkom.narotama.ac.id/
                                                                 10
Attacking the Circular Wait Condition (1)




Summary of approaches to deadlock prevention

Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   11
Other Issues
                   Two-Phase Locking

• Phase One
     – process tries to lock all records it needs, one at a time
     – if needed record found locked, start over
     – (no real work done in phase one)
• If phase one succeeds, it starts second phase,
     – performing updates
     – releasing locks
• Note similarity to requesting all resources at once
• Algorithm works where programmer can arrange
     – program can be stopped, restarted

Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                                   12
Nonresource Deadlocks

• Possible for two processes to deadlock
     – each is waiting for the other to do some task
• Can happen with semaphores
     – each process required to do a down() on two
       semaphores (mutex and another)
     – if done in wrong order, deadlock results




Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       13
Starvation
• Algorithm to allocate a resource
  – may be to give to shortest job first

• Works great for multiple short jobs in a system

• May cause long job to be postponed indefinitely
  – even though not blocked

• Solution:
  – First-come, first-serve policy
  Sistem Operasi     http://fasilkom.narotama.ac.id/
                                                       14
Question/Discussion




Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                        15

More Related Content

What's hot

Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsAJAL A J
 
Real Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsReal Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsHariharan Ganesan
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementationRajan Kumar
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its conceptsKaran Thakkar
 
Unix Process management
Unix Process managementUnix Process management
Unix Process managementWave Digitech
 
1 intro and overview
1 intro and overview1 intro and overview
1 intro and overviewBaliThorat1
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process managementArnav Chowdhury
 
Real Time Operating System Concepts
Real Time Operating System ConceptsReal Time Operating System Concepts
Real Time Operating System ConceptsSanjiv Malik
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsAditya Vichare
 
Os rtos.ppt
Os rtos.pptOs rtos.ppt
Os rtos.pptrahul km
 
Rtos princples adn case study
Rtos princples adn case studyRtos princples adn case study
Rtos princples adn case studyvanamali_vanu
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process managementBabasab Patil
 

What's hot (20)

Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
MicroC/OS-II
MicroC/OS-IIMicroC/OS-II
MicroC/OS-II
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
Real Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsReal Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systems
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Unix Process management
Unix Process managementUnix Process management
Unix Process management
 
1 intro and overview
1 intro and overview1 intro and overview
1 intro and overview
 
2 os structure
2 os structure2 os structure
2 os structure
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Ch2
Ch2Ch2
Ch2
 
Real Time Operating System Concepts
Real Time Operating System ConceptsReal Time Operating System Concepts
Real Time Operating System Concepts
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded Systems
 
Os rtos.ppt
Os rtos.pptOs rtos.ppt
Os rtos.ppt
 
Rtos princples adn case study
Rtos princples adn case studyRtos princples adn case study
Rtos princples adn case study
 
3 processes
3 processes3 processes
3 processes
 
Unit 5 ppt
Unit 5 pptUnit 5 ppt
Unit 5 ppt
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process management
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 

Viewers also liked

Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Cahyo Darujati
 
Deadlock Prevention-R.D.Sivakumar
Deadlock Prevention-R.D.SivakumarDeadlock Prevention-R.D.Sivakumar
Deadlock Prevention-R.D.SivakumarSivakumar R D .
 
24 to 25 deadlockprevention
24 to 25 deadlockprevention24 to 25 deadlockprevention
24 to 25 deadlockpreventionmyrajendra
 
Digital Divide: A Barrier in making cashless society
Digital Divide: A Barrier in making cashless societyDigital Divide: A Barrier in making cashless society
Digital Divide: A Barrier in making cashless societySumit Ranjan
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating systemMidhun Sankar
 
Sleep and rest
Sleep and restSleep and rest
Sleep and restSara Dawod
 
Hydro Salt
Hydro   SaltHydro   Salt
Hydro Saltcharsh
 
Weathering Andie
Weathering AndieWeathering Andie
Weathering Andiecharsh
 
2011 Q2 Green Viewpoint
2011 Q2 Green Viewpoint2011 Q2 Green Viewpoint
2011 Q2 Green Viewpointscottbrooker
 
Chapter 1 section 3 models
Chapter 1 section 3 modelsChapter 1 section 3 models
Chapter 1 section 3 modelscharsh
 
Onehope Lifestyle
Onehope LifestyleOnehope Lifestyle
Onehope Lifestyleguest96585f
 
S4 tarea4 gania
S4 tarea4 ganiaS4 tarea4 gania
S4 tarea4 ganiakeyrin
 
Team Census Ulhaas10 Brochure
Team Census   Ulhaas10 BrochureTeam Census   Ulhaas10 Brochure
Team Census Ulhaas10 Brochurephilemons
 

Viewers also liked (20)

Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04
 
Deadlock Prevention-R.D.Sivakumar
Deadlock Prevention-R.D.SivakumarDeadlock Prevention-R.D.Sivakumar
Deadlock Prevention-R.D.Sivakumar
 
24 to 25 deadlockprevention
24 to 25 deadlockprevention24 to 25 deadlockprevention
24 to 25 deadlockprevention
 
Os5
Os5Os5
Os5
 
Deadlock
DeadlockDeadlock
Deadlock
 
OS - Deadlock
OS - DeadlockOS - Deadlock
OS - Deadlock
 
Digital Divide: A Barrier in making cashless society
Digital Divide: A Barrier in making cashless societyDigital Divide: A Barrier in making cashless society
Digital Divide: A Barrier in making cashless society
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Sleep and rest
Sleep and restSleep and rest
Sleep and rest
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
Hydro Salt
Hydro   SaltHydro   Salt
Hydro Salt
 
Weathering Andie
Weathering AndieWeathering Andie
Weathering Andie
 
2011 Q2 Green Viewpoint
2011 Q2 Green Viewpoint2011 Q2 Green Viewpoint
2011 Q2 Green Viewpoint
 
Chapter 1 section 3 models
Chapter 1 section 3 modelsChapter 1 section 3 models
Chapter 1 section 3 models
 
Onehope Lifestyle
Onehope LifestyleOnehope Lifestyle
Onehope Lifestyle
 
Go kart
Go kartGo kart
Go kart
 
S4 tarea4 gania
S4 tarea4 ganiaS4 tarea4 gania
S4 tarea4 gania
 
Ai Tshort
Ai TshortAi Tshort
Ai Tshort
 
Team Census Ulhaas10 Brochure
Team Census   Ulhaas10 BrochureTeam Census   Ulhaas10 Brochure
Team Census Ulhaas10 Brochure
 

Similar to Kcd226 Sistem Operasi Lecture06

Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Cahyo Darujati
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].pptamadayshwan
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlockstech2click
 
Chapter 03
Chapter 03Chapter 03
Chapter 03 Google
 
Eliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationEliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationMark Stoodley
 
Intro Basic of OS .ppt
Intro Basic of OS .pptIntro Basic of OS .ppt
Intro Basic of OS .pptVarsha506533
 
Operating System Notes (1).pdf
Operating System Notes (1).pdfOperating System Notes (1).pdf
Operating System Notes (1).pdfshriyashpatil7
 
Operating System Notes help for interview pripration
Operating System Notes  help for interview priprationOperating System Notes  help for interview pripration
Operating System Notes help for interview priprationajaybiradar99999
 
Operating System Notes.pdf
Operating System Notes.pdfOperating System Notes.pdf
Operating System Notes.pdfAminaArshad42
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating SystemSanthiNivas
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Nikolay Savvinov
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxSaba651353
 

Similar to Kcd226 Sistem Operasi Lecture06 (20)

Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02
 
Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03
 
3 (2).ppt
3 (2).ppt3 (2).ppt
3 (2).ppt
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt
 
Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlocks
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
Eliminating the Pauses in your Java Application
Eliminating the Pauses in your Java ApplicationEliminating the Pauses in your Java Application
Eliminating the Pauses in your Java Application
 
Intro Basic of OS .ppt
Intro Basic of OS .pptIntro Basic of OS .ppt
Intro Basic of OS .ppt
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Operating System Notes (1).pdf
Operating System Notes (1).pdfOperating System Notes (1).pdf
Operating System Notes (1).pdf
 
Operating System Notes help for interview pripration
Operating System Notes  help for interview priprationOperating System Notes  help for interview pripration
Operating System Notes help for interview pripration
 
Operating System Notes.pdf
Operating System Notes.pdfOperating System Notes.pdf
Operating System Notes.pdf
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
CHAP4.pptx
CHAP4.pptxCHAP4.pptx
CHAP4.pptx
 
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & RecoveryDistributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
 
OS 7.pptx
OS 7.pptxOS 7.pptx
OS 7.pptx
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptx
 

More from Cahyo Darujati

Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2
Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2
Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2Cahyo Darujati
 
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...Cahyo Darujati
 
Melawan penyebaran hoax di media sosial dengan teknologi
Melawan penyebaran hoax di media sosial dengan teknologiMelawan penyebaran hoax di media sosial dengan teknologi
Melawan penyebaran hoax di media sosial dengan teknologiCahyo Darujati
 
Security is a process not a magic
Security is a process not a magicSecurity is a process not a magic
Security is a process not a magicCahyo Darujati
 
01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabaya01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabayaCahyo Darujati
 
Mengatur referensi penelitian
Mengatur referensi penelitianMengatur referensi penelitian
Mengatur referensi penelitianCahyo Darujati
 
Tatakelola Teknologi Informasi
Tatakelola Teknologi InformasiTatakelola Teknologi Informasi
Tatakelola Teknologi InformasiCahyo Darujati
 
Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02Cahyo Darujati
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Cahyo Darujati
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Cahyo Darujati
 

More from Cahyo Darujati (14)

Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2
Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2
Presentasi jaring pengaman sandi untuk mendukung spbe 29042019 rev2
 
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...
Melindungi, Mengamankan, Menanggulangi, dan Memulihkan Keamanan Informasi Pen...
 
Melawan penyebaran hoax di media sosial dengan teknologi
Melawan penyebaran hoax di media sosial dengan teknologiMelawan penyebaran hoax di media sosial dengan teknologi
Melawan penyebaran hoax di media sosial dengan teknologi
 
Security is a process not a magic
Security is a process not a magicSecurity is a process not a magic
Security is a process not a magic
 
01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabaya01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabaya
 
Mengatur referensi penelitian
Mengatur referensi penelitianMengatur referensi penelitian
Mengatur referensi penelitian
 
Tatakelola Teknologi Informasi
Tatakelola Teknologi InformasiTatakelola Teknologi Informasi
Tatakelola Teknologi Informasi
 
Pen test methodology
Pen test methodologyPen test methodology
Pen test methodology
 
pengenalan ipv6
pengenalan ipv6pengenalan ipv6
pengenalan ipv6
 
Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01
 
Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01
 
Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01
 

Recently uploaded

Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Recently uploaded (20)

Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

Kcd226 Sistem Operasi Lecture06

  • 1. Lecture 6 Deadlocks (Cont.d) 6.1. Deadlock avoidance 6.2. Deadlock prevention 6.3. Other issues Sistem Operasi http://fasilkom.narotama.ac.id/ 1
  • 2. Deadlock Avoidance Resource Trajectories Two process resource trajectories Sistem Operasi http://fasilkom.narotama.ac.id/ 2
  • 3. Safe and Unsafe States (1) (a) (b) (c) (d) (e) Demonstration that the state in (a) is safe Sistem Operasi http://fasilkom.narotama.ac.id/ 3
  • 4. Safe and Unsafe States (2) (a) (b) (c) (d) Demonstration that the sate in b is not safe Sistem Operasi http://fasilkom.narotama.ac.id/ 4
  • 5. The Banker's Algorithm for a Single Resource (a) (b) (c) • Three resource allocation states – safe – safe Sistem Operasi – unsafe http://fasilkom.narotama.ac.id/ 5
  • 6. Banker's Algorithm for Multiple Resources Example of banker's algorithm with multiple resources Sistem Operasi http://fasilkom.narotama.ac.id/ 6
  • 7. Deadlock Prevention Attacking the Mutual Exclusion Condition • Some devices (such as printer) can be spooled – only the printer daemon uses printer resource – thus deadlock for printer eliminated • Not all devices can be spooled • Principle: – avoid assigning resource when not absolutely necessary – as few processes as possible actually claim the resource Sistem Operasi http://fasilkom.narotama.ac.id/ 7
  • 8. Attacking the Hold and Wait Condition • Require processes to request resources before starting – a process never has to wait for what it needs • Problems – may not know required resources at start of run – also ties up resources other processes could be using • Variation: – process must give up all resources – then request all immediately needed Sistem Operasi http://fasilkom.narotama.ac.id/ 8
  • 9. Attacking the No Preemption Condition • This is not a viable option • Consider a process given the printer – halfway through its job – now forcibly take away printer – !!?? Sistem Operasi http://fasilkom.narotama.ac.id/ 9
  • 10. Attacking the Circular Wait Condition (1) (a) (b) • Normally ordered resources • A resource graph Sistem Operasi http://fasilkom.narotama.ac.id/ 10
  • 11. Attacking the Circular Wait Condition (1) Summary of approaches to deadlock prevention Sistem Operasi http://fasilkom.narotama.ac.id/ 11
  • 12. Other Issues Two-Phase Locking • Phase One – process tries to lock all records it needs, one at a time – if needed record found locked, start over – (no real work done in phase one) • If phase one succeeds, it starts second phase, – performing updates – releasing locks • Note similarity to requesting all resources at once • Algorithm works where programmer can arrange – program can be stopped, restarted Sistem Operasi http://fasilkom.narotama.ac.id/ 12
  • 13. Nonresource Deadlocks • Possible for two processes to deadlock – each is waiting for the other to do some task • Can happen with semaphores – each process required to do a down() on two semaphores (mutex and another) – if done in wrong order, deadlock results Sistem Operasi http://fasilkom.narotama.ac.id/ 13
  • 14. Starvation • Algorithm to allocate a resource – may be to give to shortest job first • Works great for multiple short jobs in a system • May cause long job to be postponed indefinitely – even though not blocked • Solution: – First-come, first-serve policy Sistem Operasi http://fasilkom.narotama.ac.id/ 14
  • 15. Question/Discussion Sistem Operasi http://fasilkom.narotama.ac.id/ 15