SlideShare a Scribd company logo
1 of 17
Download to read offline
Lecture 5

                           Deadlocks
                 5.1. Resource
                 5.2. Introduction to deadlocks
                 5.3. The ostrich algorithm
                 5.4. Deadlock detection and recovery




Sistem Operasi              http://fasilkom.narotama.ac.id/
                                                              1
Resources

• Examples of computer resources
   – printers
   – tape drives
   – tables
• Processes need access to resources in reasonable order
• Suppose a process holds resource A and requests
  resource B
   – at same time another process holds B and requests A
   – both are blocked and remain so

   Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                           2
Resources (1)

• Deadlocks occur when …
  – processes are granted exclusive access to devices
  – we refer to these devices generally as resources
• Preemptable resources
  – can be taken away from a process with no ill effects
• Nonpreemptable resources
  – will cause the process to fail if taken away

  Sistem Operasi     http://fasilkom.narotama.ac.id/
                                                           3
Resources (2)

•      Sequence of events required to use a resource
     1. request the resource
     2. use the resource
     3. release the resource


•        Must wait if request is denied
     –      requesting process may be blocked
     –      may fail with error code
    Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                           4
Introduction to Deadlocks

• Formal definition :
  A set of processes is deadlocked if each process in the set is waiting
  for an event that only another process in the set can cause
• Usually the event is release of a currently held resource
• None of the processes can …
   – run
   – release resources
   – be awakened


    Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                                           5
Four Conditions for Deadlock

1.        Mutual exclusion condition
      •     each resource assigned to 1 process or is available
2.        Hold and wait condition
      •     process holding resources can request additional
3.        No preemption condition
      •     previously granted resources cannot forcibly taken away
4.        Circular wait condition
      •     must be a circular chain of 2 or more processes
      •     each is waiting for resource held by next member of the
            chain
     Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                                      6
Deadlock Modeling (2)
• Modeled with directed graphs




     – resource R assigned to process A
     – process B is requesting/waiting for resource S
     – process C and D are in deadlock over resources T and U
Sistem Operasi        http://fasilkom.narotama.ac.id/
                                                                7
Deadlock Modeling (3)

Strategies for dealing with Deadlocks
     1.        just ignore the problem altogether
     2.        detection and recovery
     3.        dynamic avoidance
           •      careful resource allocation
     4.        prevention
           •      negating one of the four necessary conditions



Sistem Operasi               http://fasilkom.narotama.ac.id/
                                                                  8
Deadlock Modeling (4)
                         A               B              C




Sistem Operasi        http://fasilkom.narotama.ac.id/
                    How deadlock occurs                     9
Deadlock Modeling (5)




                        (o)                (p)            (q)

Sistem Operasi          http://fasilkom.narotama.ac.id/
                  How deadlock can be avoided                   10
The Ostrich Algorithm
• Pretend there is no problem
• Reasonable if
     – deadlocks occur very rarely
     – cost of prevention is high
• UNIX and Windows takes this approach
• It is a trade off between
     – convenience
     – correctness

Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                         11
Detection with One Resource of Each Type (1)




• Note the resource ownership and requests
• A cycle can be found within the graph, denoting deadlock

  Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                        12
Detection with One Resource of Each Type (2)




 Data structures needed by deadlock detection algorithm

  Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                          13
Detection with One Resource of Each Type (3)




 An example for the deadlock detection algorithm
  Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                     14
Recovery from Deadlock (1)

• Recovery through preemption
     – take a resource from some other process
     – depends on nature of the resource
• Recovery through rollback
     – checkpoint a process periodically
     – use this saved state
     – restart the process if it is found deadlocked


Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       15
Recovery from Deadlock (2)


• Recovery through killing processes
   –   crudest but simplest way to break a deadlock
   –   kill one of the processes in the deadlock cycle
   –   the other processes get its resources
   –   choose process that can be rerun from the beginning




 Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                             16
Question/Discussion




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

More Related Content

Viewers also liked

Patrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae SlidesPatrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae SlidesAjax Experience 2009
 
Tom Ferry Presentation
Tom Ferry PresentationTom Ferry Presentation
Tom Ferry PresentationJim Marks
 
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...RCSLLC
 
Cardiovascular system or the circulatory system
Cardiovascular system or the circulatory systemCardiovascular system or the circulatory system
Cardiovascular system or the circulatory systemsnozza66
 
Facebook, Brands and TV Preview Next Conference 2010 Berlin
Facebook, Brands and TV  Preview Next Conference 2010 BerlinFacebook, Brands and TV  Preview Next Conference 2010 Berlin
Facebook, Brands and TV Preview Next Conference 2010 BerlinZucker.Kommunikation
 
Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]Ajax Experience 2009
 
201104.wv.uva college peacebuilding le co
201104.wv.uva college peacebuilding le co201104.wv.uva college peacebuilding le co
201104.wv.uva college peacebuilding le coWout Visser
 
S4 tarea4 gania
S4 tarea4 ganiaS4 tarea4 gania
S4 tarea4 ganiakeyrin
 
Samiya Hethcock's Javita Weight Loss Testimonial
Samiya Hethcock's Javita Weight Loss TestimonialSamiya Hethcock's Javita Weight Loss Testimonial
Samiya Hethcock's Javita Weight Loss TestimonialIntello
 
موسوعة غينس للارقام القياسيه 3
موسوعة غينس للارقام القياسيه 3موسوعة غينس للارقام القياسيه 3
موسوعة غينس للارقام القياسيه 3arabogrop
 
信息分类和方法
信息分类和方法信息分类和方法
信息分类和方法tony
 
Test Analyst 3 + Yrs Manual Automation Theme
Test Analyst 3 + Yrs Manual Automation ThemeTest Analyst 3 + Yrs Manual Automation Theme
Test Analyst 3 + Yrs Manual Automation Themeamitcitm
 
Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009Ajax Experience 2009
 
Absolute Dating
Absolute DatingAbsolute Dating
Absolute Datingcharsh
 

Viewers also liked (20)

Patrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae SlidesPatrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae Slides
 
Tom Ferry Presentation
Tom Ferry PresentationTom Ferry Presentation
Tom Ferry Presentation
 
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
 
Cardiovascular system or the circulatory system
Cardiovascular system or the circulatory systemCardiovascular system or the circulatory system
Cardiovascular system or the circulatory system
 
Facebook, Brands and TV Preview Next Conference 2010 Berlin
Facebook, Brands and TV  Preview Next Conference 2010 BerlinFacebook, Brands and TV  Preview Next Conference 2010 Berlin
Facebook, Brands and TV Preview Next Conference 2010 Berlin
 
Redes Sociales2
Redes Sociales2Redes Sociales2
Redes Sociales2
 
Kurikulum 2013 SMA
Kurikulum 2013 SMAKurikulum 2013 SMA
Kurikulum 2013 SMA
 
Sheepshead bay
Sheepshead baySheepshead bay
Sheepshead bay
 
Aplicaciones moviles
Aplicaciones movilesAplicaciones moviles
Aplicaciones moviles
 
Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]
 
201104.wv.uva college peacebuilding le co
201104.wv.uva college peacebuilding le co201104.wv.uva college peacebuilding le co
201104.wv.uva college peacebuilding le co
 
S4 tarea4 gania
S4 tarea4 ganiaS4 tarea4 gania
S4 tarea4 gania
 
Samiya Hethcock's Javita Weight Loss Testimonial
Samiya Hethcock's Javita Weight Loss TestimonialSamiya Hethcock's Javita Weight Loss Testimonial
Samiya Hethcock's Javita Weight Loss Testimonial
 
موسوعة غينس للارقام القياسيه 3
موسوعة غينس للارقام القياسيه 3موسوعة غينس للارقام القياسيه 3
موسوعة غينس للارقام القياسيه 3
 
信息分类和方法
信息分类和方法信息分类和方法
信息分类和方法
 
Test Analyst 3 + Yrs Manual Automation Theme
Test Analyst 3 + Yrs Manual Automation ThemeTest Analyst 3 + Yrs Manual Automation Theme
Test Analyst 3 + Yrs Manual Automation Theme
 
Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009
 
Absolute Dating
Absolute DatingAbsolute Dating
Absolute Dating
 
Wave Energy
Wave EnergyWave Energy
Wave Energy
 
Variability
VariabilityVariability
Variability
 

Similar to Kcd226 Sistem Operasi Lecture05

3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].pptamadayshwan
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxSaba651353
 
Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Cahyo Darujati
 
28 to 29 detection
28 to 29 detection 28 to 29 detection
28 to 29 detection myrajendra
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxAmanuelmergia
 
Chapter 03
Chapter 03Chapter 03
Chapter 03 Google
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxAmanuelmergia
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)WajeehaBaig
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptxsvulasal
 

Similar to Kcd226 Sistem Operasi Lecture05 (20)

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
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptx
 
Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04Kcd226 Sistem Operasi Lecture04
Kcd226 Sistem Operasi Lecture04
 
06-Deadlocks.ppt
06-Deadlocks.ppt06-Deadlocks.ppt
06-Deadlocks.ppt
 
chapter06-new.pptx
chapter06-new.pptxchapter06-new.pptx
chapter06-new.pptx
 
OS-Part-06.pdf
OS-Part-06.pdfOS-Part-06.pdf
OS-Part-06.pdf
 
28 to 29 detection
28 to 29 detection 28 to 29 detection
28 to 29 detection
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptx
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptx
 
Deadlocks2
Deadlocks2Deadlocks2
Deadlocks2
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Chapter06.ppt
Chapter06.pptChapter06.ppt
Chapter06.ppt
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.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
 
Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi 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
 

More from Cahyo Darujati (16)

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
 
Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03
 
Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi 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
 

Recently uploaded

How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Comparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxComparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxAvaniJani1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 

Recently uploaded (20)

How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Comparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxComparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptx
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 

Kcd226 Sistem Operasi Lecture05

  • 1. Lecture 5 Deadlocks 5.1. Resource 5.2. Introduction to deadlocks 5.3. The ostrich algorithm 5.4. Deadlock detection and recovery Sistem Operasi http://fasilkom.narotama.ac.id/ 1
  • 2. Resources • Examples of computer resources – printers – tape drives – tables • Processes need access to resources in reasonable order • Suppose a process holds resource A and requests resource B – at same time another process holds B and requests A – both are blocked and remain so Sistem Operasi http://fasilkom.narotama.ac.id/ 2
  • 3. Resources (1) • Deadlocks occur when … – processes are granted exclusive access to devices – we refer to these devices generally as resources • Preemptable resources – can be taken away from a process with no ill effects • Nonpreemptable resources – will cause the process to fail if taken away Sistem Operasi http://fasilkom.narotama.ac.id/ 3
  • 4. Resources (2) • Sequence of events required to use a resource 1. request the resource 2. use the resource 3. release the resource • Must wait if request is denied – requesting process may be blocked – may fail with error code Sistem Operasi http://fasilkom.narotama.ac.id/ 4
  • 5. Introduction to Deadlocks • Formal definition : A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause • Usually the event is release of a currently held resource • None of the processes can … – run – release resources – be awakened Sistem Operasi http://fasilkom.narotama.ac.id/ 5
  • 6. Four Conditions for Deadlock 1. Mutual exclusion condition • each resource assigned to 1 process or is available 2. Hold and wait condition • process holding resources can request additional 3. No preemption condition • previously granted resources cannot forcibly taken away 4. Circular wait condition • must be a circular chain of 2 or more processes • each is waiting for resource held by next member of the chain Sistem Operasi http://fasilkom.narotama.ac.id/ 6
  • 7. Deadlock Modeling (2) • Modeled with directed graphs – resource R assigned to process A – process B is requesting/waiting for resource S – process C and D are in deadlock over resources T and U Sistem Operasi http://fasilkom.narotama.ac.id/ 7
  • 8. Deadlock Modeling (3) Strategies for dealing with Deadlocks 1. just ignore the problem altogether 2. detection and recovery 3. dynamic avoidance • careful resource allocation 4. prevention • negating one of the four necessary conditions Sistem Operasi http://fasilkom.narotama.ac.id/ 8
  • 9. Deadlock Modeling (4) A B C Sistem Operasi http://fasilkom.narotama.ac.id/ How deadlock occurs 9
  • 10. Deadlock Modeling (5) (o) (p) (q) Sistem Operasi http://fasilkom.narotama.ac.id/ How deadlock can be avoided 10
  • 11. The Ostrich Algorithm • Pretend there is no problem • Reasonable if – deadlocks occur very rarely – cost of prevention is high • UNIX and Windows takes this approach • It is a trade off between – convenience – correctness Sistem Operasi http://fasilkom.narotama.ac.id/ 11
  • 12. Detection with One Resource of Each Type (1) • Note the resource ownership and requests • A cycle can be found within the graph, denoting deadlock Sistem Operasi http://fasilkom.narotama.ac.id/ 12
  • 13. Detection with One Resource of Each Type (2) Data structures needed by deadlock detection algorithm Sistem Operasi http://fasilkom.narotama.ac.id/ 13
  • 14. Detection with One Resource of Each Type (3) An example for the deadlock detection algorithm Sistem Operasi http://fasilkom.narotama.ac.id/ 14
  • 15. Recovery from Deadlock (1) • Recovery through preemption – take a resource from some other process – depends on nature of the resource • Recovery through rollback – checkpoint a process periodically – use this saved state – restart the process if it is found deadlocked Sistem Operasi http://fasilkom.narotama.ac.id/ 15
  • 16. Recovery from Deadlock (2) • Recovery through killing processes – crudest but simplest way to break a deadlock – kill one of the processes in the deadlock cycle – the other processes get its resources – choose process that can be rerun from the beginning Sistem Operasi http://fasilkom.narotama.ac.id/ 16
  • 17. Question/Discussion Sistem Operasi http://fasilkom.narotama.ac.id/ 17