Inter-Process Communication
Processes are isolated by design: each has its own address space, and one cannot read another's variables.
Operating Systems · topic
Inter-process communication by shared memory, message passing and pipes; race conditions and the three critical-section requirements; Peterson, bakery and hardware instructions; semaphores, mutexes and monitors; producer-consumer, readers-writers and dining philosophers.
Processes are isolated by design: each has its own address space, and one cannot read another's variables.
When two threads update shared data at the same time, the result can depend on the exact order in which their machine instructions interleave. That situation is a race condition.
Peterson's algorithm and TestAndSet loops solve mutual exclusion, but they are awkward to use and they busy-wait. Operating systems offer higher-level tools instead.
1) are the standard test bed for any new synchronization primitive. The bounded-buffer (producer-consumer) problem is about counting and waiting for space or data. The readers-writers problem is about letting many readers share while writers get exclusive access, and about who gets starved.
One-page visual sheets for this topic, in the sheet library on the store. Previews are free; the full sheets come with the subject pack.