Lecture Notes for Operating Systems Concepts
27 September 2001 - Process Synchronization
- process interaction
- the basics
- serial vs concurrent execution
- serial software is inefficient and can get complicated to design
- cheap and plentiful multi-processor systems and networked computers
- big-piece concurrency can be easier and more efficient than one-piece
serial software - no concepts, not well supported, no standards
- coordinated and uncoordinated concurrency - sharing vs protection
- interaction styles
- shared data - the fundamental style; independent reading and writing
- the dining philosophers problem
- producer-consumer - a common style with one-way data movement
- readers-writers - a common special case
- pure synchronization - the sleeping barber problem
- process coordination - in space or time
- in time - activities occurring in the proper order
- in space - unmediated access to shared resources
- fork-join concurrency - for coordination in time
- synchronization at the atomic process level
- critical sections - for coordination in space
- guaranteed exclusive access - mutual exclusion
- no sharing, no problem
- semaphores - a bowl with a stone in it
- principles
- no advance without the stone
- no fighting over the stone - one process gets it cleanly
- how waiters wait - cpu intensive or not
- how waiters go for the stone
- implementation
- busy wait - ok for multiprocessors, bad for uniprocessors
- block - good for uniprocessors; context switches
- implementing atomicity - interrupts, atomic instructions, software
solutions
- handing off vs context switching
- use
- mutex semaphores - binary semaphores providing mutual exclusion
- counting semaphores - many stones in the bowl; manage reusable
resources
- semaphores can serve as the basis for other synchronization
mechanisms - monitors
- comments
- semaphores are simple but primitive - difficult to manage many of them
- semaphore signals don't disappear
- there are as many semaphore semantics as there are semaphores
- shared-memory multiprocessors
This page last modified on 8 October 2001.