process synchronization_notes
process synchronization_notes
Objectives
• Introduce the concept of process synchronization.
• Discuss the critical-section problem and solutions to ensure shared data consistency.
Background
• Concurrent Execution: Processes can execute simultaneously and may be interrupted,
risking incomplete execution.
• Structure:
• Entry Section: Code per process to request entry into the critical section.
2. Progress: If no process in the critical section, selection of the next process must not be
postponed indefinitely.
Peterson’s Solution
• A two-process solution using atomic load and store instructions to ensure mutual
exclusion, progress, and bounded waiting are met:
Synchronization Hardware
• Locking Mechanisms:
Lock-based Solutions:
• Types include binary semaphores (similar to mutex) and counting semaphores (range
of values).
• Semaphore use, including considerations of deadlock and priority inversion, which may
arise with improper semaphore operations.
Monitors
• High-level abstraction for synchronization, allowing only one process at a time within the
monitor.
• Uses condition variables with operations like wait() and signal() to manage process state
transitions.
Monitor-driven Solutions:
• Dining Philosophers example solution using monitor-based methods to prevent deadlock
and manage concurrent activities.
• Linux: Offers semaphores, spinlocks, and reader-writer variants with options influenced by
kernel version.
• Pthreads: Provides API with mutex locks and condition variables, supporting
synchronization across different OS.
Alternative Approaches
• Transactional Memory: Uses atomic sequences of read-write operations to memory.
These notes encapsulate crucial concepts and solutions concerning process synchronization,
providing foundational insights suitable for further study in operating systems.