1 Pertemuan 6 Komunikasi antar Proses (IPC) Lanjutan Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5 OFFCLASS01
2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : menerangkan interprocess communication tanpa busy waiting (C2)
3 Outline Materi Semaphore Mutexes Monitor Message Passing
4 Operation DOWN and UP are Atomic Action INTERPROCESS COMMUNICATION (Cont’d) SEMAPHORES Integer variable to count the number of wakeups It is 0 if there is no wakeup, or some positive value if one or more wakeups were pending 1.DOWN (S) S = S – 1 IF (S < 0) THEN SLEEP 2.UP (S) S = S + 1 IF (S <= 0) THEN WAKEUP Two operations on semaphore: 1.DOWN (S) IF (S > 0) THEN S = S – 1 ELSE SLEEP Or alternatively
5 The producer-consumer problem using semaphores
6 Implementation of mutex_lock and mutex_unlock MUTEXES Variable that can be one of two states: unlocked or locked
7 MONITORS Higher level synchronization primitives A collection of procedure, variables and data structure that are all packed together into a module A monitor
8 Only one monitor procedure can be active at a time Buffer has N slots Producer-consumer problem using monitors
9 MESSAGE PASSING Two primitives: Send (destination, &message) Receive (source, &message) Design issues for message passing system Message lost Acknowledgement Domains Authentication Performance
10 Implementation of producer- consumer problem using message passing
11 Several variants of message passing: Mailbox Buffering mechanism Rendezvous No buffering mechanism