1 / 15

Pertemuan 5 Komunikasi antar Proses / Interprocess Communication (IPC)

Pertemuan 5 Komunikasi antar Proses / Interprocess Communication (IPC). Matakuliah : T0316/sistem Operasi Tahun : 2005 Versi/Revisi : 5. OFFCLASS01. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu :

yannis
Download Presentation

Pertemuan 5 Komunikasi antar Proses / Interprocess Communication (IPC)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pertemuan 5Komunikasi antar Proses /Interprocess Communication (IPC) Matakuliah : T0316/sistem Operasi Tahun : 2005 Versi/Revisi : 5 OFFCLASS01

  2. Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : • menjelaskan perlunya komunikasi antar process, dan menerangkan beberapa mekanisme untuk berkomunikasi (C2)

  3. Outline Materi • Race Condition • Critical Region • Mutual Exclusion with busy waiting • Disabling interrupts • Lock variables • Strict Alternation • Peterson’s solution • TSL Instruction • Sleep and wakeup

  4. Interprocess Communication Problems -Passing information between process -Making sure two or more processes do not get into each other’s way -Proper sequencing when dependencies are present RACE CONDITION Situation where two or more processes are reading or writing some shared data and the final result depends on who runs precisely when

  5. Examples: spooler directory for printer Two processes want to access shared memory at same time

  6. spooler (2) Process A Readsin = 7 Store local_next_slot = 7 Readslocal_next_slot = 7 Storebuffer[7] = A Updatein = 8 Process B Reads in = 7 Store local_next_slot = 7 Store buffer[7] = B Update in = 8 B will never receive any output

  7. Critical Regions Part of the programs in which the shared memory is accessed Mutual Exclusion: Þmechanism to prevent process accessing resource used by another process Four conditions to provide mutual exclusion No two processes simultaneously in critical region No assumptions made about speeds or numbers of CPUs No process running outside its critical region may block another process No process must wait forever to enter its critical region

  8. Mutual exclusion using critical regions

  9. Mutual Exclusion with Busy Waiting 1. Disabling Interrupt ÞEach process disable all interrupts just after entering its critical regions and re-enable them just before leaving it but, disabling interrupt shall not be carried out by user process

  10. 2. Lock Variables -Shared (lock) variables, initially set to 0 -If lock = 0, lock is set to = 1, then enters the critial region -If lock = 1, wait until lock = 0 problem: race condition

  11. 3. Strict Alternation (a) Process 0. (b) Process 1.

  12. 4. Peterson’s Solution

  13. 5. TSL Instruction (Test and Set Lock) Initially lock = 0  JNE = false  just RET Note: Peterson and TSL are correct bur requires busy waiting

  14. Sleep and Wakeup Sleep: system call yang menyebabkan proses yang memanggil diblock, atau ditunda (suspended) Wakup: system call yang menyebabkan proses dibangunkan, atau menjadi ready Case: Producer-Consumer Problem (Bounded-Buffer Problem)

  15. Example of producer-consumer problem with fatal race condition

More Related