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

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
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
 
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
 
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
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
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
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
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
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
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...
 
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
 
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 🔝✔️✔️
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
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
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
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
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

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