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