SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Lecture 4
           Interprocess and Scheduling

                 4.1. Interprocess communication
                 4.2. Classical IPC problems
                 4.3. Scheduling




Sistem Operasi          http://fasilkom.narotama.ac.id/
                                                          1
Interprocess Communication
                   Race Conditions




Two processes want to access shared memory at same time
  Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                          2
Critical Regions (1)

Four conditions to provide mutual exclusion
1.   No two processes simultaneously in critical region
2.   No assumptions made about speeds or numbers of CPUs
3.   No process running outside its critical region may block
     another process
4.   No process must wait forever to enter its critical region



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




        Mutual exclusion using critical regions
Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                       4
Mutual Exclusion with Busy Waiting (1)




  Proposed solution to critical region problem
     (a) Process 0.
Sistem Operasi
                           (b) Process 1.
                      http://fasilkom.narotama.ac.id/
                                                        5
Mutual Exclusion with Busy Waiting (2)




  Sistem Operasi   http://fasilkom.narotama.ac.id/
Peterson's solution for achieving mutual exclusion   6
Mutual Exclusion with Busy Waiting (3)




Entering and leaving a critical region using the
Sistem Operasi TSL instruction
                http://fasilkom.narotama.ac.id/
                                                   7
Sleep and Wakeup




Producer-consumer http://fasilkom.narotama.ac.id/ fatal race condition8
   Sistem Operasi
                  problem with
Semaphores




TheSistem Operasi http://fasilkom.narotama.ac.id/
    producer-consumer problem using semaphores      9
Mutexes




Implementation of mutex_lock and mutex_unlock
 Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    10
Monitors (1)




Sistem Operasi   Example of a monitor
                    http://fasilkom.narotama.ac.id/
                                                      11
Monitors (2)




• Outline of producer-consumer problem with monitors
  – only one monitor procedure active at one time
  Sistem Operasi           http://fasilkom.narotama.ac.id/
  – buffer has N slots                                       12
Monitors (3)




Solution to producer-consumer problem in Java (part 1)
 Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                         13
Monitors (4)




Solution to producer-consumer problem in Java (part 2)
Sistem Operasi    http://fasilkom.narotama.ac.id/
                                                         14
Message Passing




The producer-consumer problem with N messages
 Sistem Operasi  http://fasilkom.narotama.ac.id/
                                                   15
Barriers




• Use of a barrier
      – processes approaching a barrier
      – all processes but one blocked at barrier
Sistem Operasi         http://fasilkom.narotama.ac.id/
      – last process arrives, all are let through        16
Dining Philosophers (1)


•   Philosophers eat/think
•   Eating needs 2 forks
•   Pick one fork at a time
•   How to prevent deadlock




    Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                             17
Dining Philosophers (2)




A nonsolution to the dining philosophers problem
 Sistem Operasi         http://fasilkom.narotama.ac.id/
                                                          18
Dining Philosophers (3)




Sistem Operasi         http://fasilkom.narotama.ac.id/
Solution to dining philosophers problem (part 1)         19
Dining Philosophers (4)




Sistem Operasi      http://fasilkom.narotama.ac.id/
Solution to dining philosophers problem (part 2)      20
The Readers and Writers Problem




 A solution to the readers and writers problem
Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   21
The Sleeping Barber Problem (1)




Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   22
The Sleeping Barber Problem (2)




Sistem Operasi    http://fasilkom.narotama.ac.id/
                 Solution to sleeping barber problem.   23
Scheduling
                   Introduction to Scheduling (1)




• Bursts of CPU usage alternate with periods of I/O wait
   – a CPU-bound process
   – an I/O bound process
  Sistem Operasi           http://fasilkom.narotama.ac.id/
                                                             24
Introduction to Scheduling (2)




Sistem Operasi   Scheduling Algorithm Goals
                        http://fasilkom.narotama.ac.id/
                                                          25
Scheduling in Batch Systems (1)




   An example of shortest job first scheduling
Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                   26
Scheduling in Batch Systems (2)




Sistem Operasi   Three level scheduling
                     http://fasilkom.narotama.ac.id/
                                                       27
Scheduling in Interactive Systems (1)




• Round Robin Scheduling
  – list of runnable processes
  – list of runnable processes after B uses up its quantum
  Sistem Operasi      http://fasilkom.narotama.ac.id/
                                                             28
Scheduling in Interactive Systems (2)




A scheduling algorithm with four priority classes
 Sistem Operasi   http://fasilkom.narotama.ac.id/
                                                    29
Scheduling in Real-Time Systems


Schedulable real-time system
• Given
     – m periodic events
     – event i occurs within period Pi and requires Ci
       seconds
• Then the load can only be handled if
                        m
                          Ci
                     ∑ P ≤1
                     i =1
Sistem Operasi             i
                     http://fasilkom.narotama.ac.id/
                                                         30
Policy versus Mechanism

• Separate what is allowed to be done with
  how it is done
      – a process knows which of its children threads
        are important and need priority

• Scheduling algorithm parameterized
      – mechanism in the kernel

• Parameters filled in by user processes
      – policy set by user process
Sistem Operasi       http://fasilkom.narotama.ac.id/
                                                        31
Thread Scheduling (1)




      Possible scheduling of user-level threads
        • 50-msec process quantum
        • threads run http://fasilkom.narotama.ac.id/
Sistem Operasi
                      5 msec/CPU burst                  32
Thread Scheduling (2)




      Possible scheduling of kernel-level threads
        • 50-msec process quantum
        • threads run http://fasilkom.narotama.ac.id/
Sistem Operasi        5 msec/CPU burst
                                                        33
Question ?




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

Contenu connexe

Tendances

Chapter 02 modified
Chapter 02 modifiedChapter 02 modified
Chapter 02 modified
Jugal Doshi
 
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
Monica Sabharwal
 
process management
 process management process management
process management
Ashish Kumar
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
Rohit Joshi
 

Tendances (20)

Chapter 02 modified
Chapter 02 modifiedChapter 02 modified
Chapter 02 modified
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
 
Windows process scheduling presentation
Windows process scheduling presentationWindows process scheduling presentation
Windows process scheduling presentation
 
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
 
Os2
Os2Os2
Os2
 
Real time-embedded-system-lec-02
Real time-embedded-system-lec-02Real time-embedded-system-lec-02
Real time-embedded-system-lec-02
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
Rtos part2
Rtos part2Rtos part2
Rtos part2
 
3 process management
3 process management3 process management
3 process management
 
Lecture 5 process concept
Lecture 5   process conceptLecture 5   process concept
Lecture 5 process concept
 
process management
 process management process management
process management
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Chapter 19 - Real Time Systems
Chapter 19 - Real Time SystemsChapter 19 - Real Time Systems
Chapter 19 - Real Time Systems
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
 
Os notes
Os notesOs notes
Os notes
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systems
 

En vedette (20)

Chapter9
Chapter9Chapter9
Chapter9
 
1. review jurnal effect dwi hastho
1. review jurnal effect dwi hastho1. review jurnal effect dwi hastho
1. review jurnal effect dwi hastho
 
Ipc ppt
Ipc pptIpc ppt
Ipc ppt
 
Op Sy 03 Ch 23
Op Sy 03 Ch 23Op Sy 03 Ch 23
Op Sy 03 Ch 23
 
Kcd226 Sistem Operasi Lecture06
Kcd226 Sistem Operasi Lecture06Kcd226 Sistem Operasi Lecture06
Kcd226 Sistem Operasi Lecture06
 
IPC
IPCIPC
IPC
 
2. review jurnal barrier dwi hastho
2. review jurnal barrier dwi hastho2. review jurnal barrier dwi hastho
2. review jurnal barrier dwi hastho
 
Ch4: Processes (OS)
Ch4: Processes (OS)Ch4: Processes (OS)
Ch4: Processes (OS)
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
Guide
GuideGuide
Guide
 
sql
sqlsql
sql
 
My SQl
My SQlMy SQl
My SQl
 
IP Addressing
IP AddressingIP Addressing
IP Addressing
 
Saftey
SafteySaftey
Saftey
 
Mysql
MysqlMysql
Mysql
 
I/O Management
I/O ManagementI/O Management
I/O Management
 
Shell Script
Shell ScriptShell Script
Shell Script
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 
Network Security
Network SecurityNetwork Security
Network Security
 
Operating systems
Operating systemsOperating systems
Operating systems
 

Similaire à Kcd226 Sistem Operasi Lecture04

Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03Kcd226 Sistem Operasi Lecture03
Kcd226 Sistem Operasi Lecture03
Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02Kcd226 Sistem Operasi Lecture02
Kcd226 Sistem Operasi Lecture02
Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
Cahyo Darujati
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01
Cahyo Darujati
 
IT241 - Full Summary.pdf
IT241 - Full Summary.pdfIT241 - Full Summary.pdf
IT241 - Full Summary.pdf
SHEHABALYAMANI
 

Similaire à Kcd226 Sistem Operasi Lecture04 (20)

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
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
 
OPERATING SYSTEM CHAPTER 3.ppt
OPERATING SYSTEM CHAPTER 3.pptOPERATING SYSTEM CHAPTER 3.ppt
OPERATING SYSTEM CHAPTER 3.ppt
 
procress and threads.ppt
procress and threads.pptprocress and threads.ppt
procress and threads.ppt
 
Processes and Threads in modern Operating system
Processes and Threads in modern Operating systemProcesses and Threads in modern Operating system
Processes and Threads in modern Operating system
 
Process and Thread
Process and Thread Process and Thread
Process and Thread
 
OS_MD_1.pdf
OS_MD_1.pdfOS_MD_1.pdf
OS_MD_1.pdf
 
Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01Kbk436 Sistem Operasi Lanjut Lecture01
Kbk436 Sistem Operasi Lanjut Lecture01
 
Intro720T5.pptx
Intro720T5.pptxIntro720T5.pptx
Intro720T5.pptx
 
Embedded systems notes
Embedded systems notesEmbedded systems notes
Embedded systems notes
 
Operating System-Ch2 computer system structures
Operating System-Ch2 computer system structuresOperating System-Ch2 computer system structures
Operating System-Ch2 computer system structures
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
IT241 - Full Summary.pdf
IT241 - Full Summary.pdfIT241 - Full Summary.pdf
IT241 - Full Summary.pdf
 
Ch2.1 computer system structures
Ch2.1 computer system structures Ch2.1 computer system structures
Ch2.1 computer system structures
 
Processes and Thread OS_Tanenbaum_3e
Processes and Thread OS_Tanenbaum_3eProcesses and Thread OS_Tanenbaum_3e
Processes and Thread OS_Tanenbaum_3e
 
EC 308 Embedded Systems Module 1 Notes APJKTU
EC 308 Embedded Systems Module 1 Notes APJKTUEC 308 Embedded Systems Module 1 Notes APJKTU
EC 308 Embedded Systems Module 1 Notes APJKTU
 
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
 

Plus de Cahyo Darujati

01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabaya01.welcome.ppt.sosialisasi.skkni.surabaya
01.welcome.ppt.sosialisasi.skkni.surabaya
Cahyo Darujati
 
Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02Kbk436 Sistem Operasi Lanjut Lecture02
Kbk436 Sistem Operasi Lanjut Lecture02
Cahyo Darujati
 
Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01Kcd226 Sistem Operasi Lecture01
Kcd226 Sistem Operasi Lecture01
Cahyo Darujati
 

Plus de Cahyo Darujati (13)

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
 
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
 

Dernier

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Kcd226 Sistem Operasi Lecture04

  • 1. Lecture 4 Interprocess and Scheduling 4.1. Interprocess communication 4.2. Classical IPC problems 4.3. Scheduling Sistem Operasi http://fasilkom.narotama.ac.id/ 1
  • 2. Interprocess Communication Race Conditions Two processes want to access shared memory at same time Sistem Operasi http://fasilkom.narotama.ac.id/ 2
  • 3. Critical Regions (1) Four conditions to provide mutual exclusion 1. No two processes simultaneously in critical region 2. No assumptions made about speeds or numbers of CPUs 3. No process running outside its critical region may block another process 4. No process must wait forever to enter its critical region Sistem Operasi http://fasilkom.narotama.ac.id/ 3
  • 4. Critical Regions (2) Mutual exclusion using critical regions Sistem Operasi http://fasilkom.narotama.ac.id/ 4
  • 5. Mutual Exclusion with Busy Waiting (1) Proposed solution to critical region problem (a) Process 0. Sistem Operasi (b) Process 1. http://fasilkom.narotama.ac.id/ 5
  • 6. Mutual Exclusion with Busy Waiting (2) Sistem Operasi http://fasilkom.narotama.ac.id/ Peterson's solution for achieving mutual exclusion 6
  • 7. Mutual Exclusion with Busy Waiting (3) Entering and leaving a critical region using the Sistem Operasi TSL instruction http://fasilkom.narotama.ac.id/ 7
  • 8. Sleep and Wakeup Producer-consumer http://fasilkom.narotama.ac.id/ fatal race condition8 Sistem Operasi problem with
  • 9. Semaphores TheSistem Operasi http://fasilkom.narotama.ac.id/ producer-consumer problem using semaphores 9
  • 10. Mutexes Implementation of mutex_lock and mutex_unlock Sistem Operasi http://fasilkom.narotama.ac.id/ 10
  • 11. Monitors (1) Sistem Operasi Example of a monitor http://fasilkom.narotama.ac.id/ 11
  • 12. Monitors (2) • Outline of producer-consumer problem with monitors – only one monitor procedure active at one time Sistem Operasi http://fasilkom.narotama.ac.id/ – buffer has N slots 12
  • 13. Monitors (3) Solution to producer-consumer problem in Java (part 1) Sistem Operasi http://fasilkom.narotama.ac.id/ 13
  • 14. Monitors (4) Solution to producer-consumer problem in Java (part 2) Sistem Operasi http://fasilkom.narotama.ac.id/ 14
  • 15. Message Passing The producer-consumer problem with N messages Sistem Operasi http://fasilkom.narotama.ac.id/ 15
  • 16. Barriers • Use of a barrier – processes approaching a barrier – all processes but one blocked at barrier Sistem Operasi http://fasilkom.narotama.ac.id/ – last process arrives, all are let through 16
  • 17. Dining Philosophers (1) • Philosophers eat/think • Eating needs 2 forks • Pick one fork at a time • How to prevent deadlock Sistem Operasi http://fasilkom.narotama.ac.id/ 17
  • 18. Dining Philosophers (2) A nonsolution to the dining philosophers problem Sistem Operasi http://fasilkom.narotama.ac.id/ 18
  • 19. Dining Philosophers (3) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to dining philosophers problem (part 1) 19
  • 20. Dining Philosophers (4) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to dining philosophers problem (part 2) 20
  • 21. The Readers and Writers Problem A solution to the readers and writers problem Sistem Operasi http://fasilkom.narotama.ac.id/ 21
  • 22. The Sleeping Barber Problem (1) Sistem Operasi http://fasilkom.narotama.ac.id/ 22
  • 23. The Sleeping Barber Problem (2) Sistem Operasi http://fasilkom.narotama.ac.id/ Solution to sleeping barber problem. 23
  • 24. Scheduling Introduction to Scheduling (1) • Bursts of CPU usage alternate with periods of I/O wait – a CPU-bound process – an I/O bound process Sistem Operasi http://fasilkom.narotama.ac.id/ 24
  • 25. Introduction to Scheduling (2) Sistem Operasi Scheduling Algorithm Goals http://fasilkom.narotama.ac.id/ 25
  • 26. Scheduling in Batch Systems (1) An example of shortest job first scheduling Sistem Operasi http://fasilkom.narotama.ac.id/ 26
  • 27. Scheduling in Batch Systems (2) Sistem Operasi Three level scheduling http://fasilkom.narotama.ac.id/ 27
  • 28. Scheduling in Interactive Systems (1) • Round Robin Scheduling – list of runnable processes – list of runnable processes after B uses up its quantum Sistem Operasi http://fasilkom.narotama.ac.id/ 28
  • 29. Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes Sistem Operasi http://fasilkom.narotama.ac.id/ 29
  • 30. Scheduling in Real-Time Systems Schedulable real-time system • Given – m periodic events – event i occurs within period Pi and requires Ci seconds • Then the load can only be handled if m Ci ∑ P ≤1 i =1 Sistem Operasi i http://fasilkom.narotama.ac.id/ 30
  • 31. Policy versus Mechanism • Separate what is allowed to be done with how it is done – a process knows which of its children threads are important and need priority • Scheduling algorithm parameterized – mechanism in the kernel • Parameters filled in by user processes – policy set by user process Sistem Operasi http://fasilkom.narotama.ac.id/ 31
  • 32. Thread Scheduling (1) Possible scheduling of user-level threads • 50-msec process quantum • threads run http://fasilkom.narotama.ac.id/ Sistem Operasi 5 msec/CPU burst 32
  • 33. Thread Scheduling (2) Possible scheduling of kernel-level threads • 50-msec process quantum • threads run http://fasilkom.narotama.ac.id/ Sistem Operasi 5 msec/CPU burst 33
  • 34. Question ? Sistem Operasi http://fasilkom.narotama.ac.id/ 34