Please enable JavaScript.
Coggle requires JavaScript to display documents.
Process Synchronization and Control - Coggle Diagram
Process Synchronization and Control
Mutual exclusion
Ensures that only one process at a time accesses a shared resource or critical section
Goal
Avoid racing conditions.
Implementation Mechanism
Semaphores:
→
Control access using values of 0 or 1.
Mutexes (Mutual Exclusions):
→
Act as a binary switch; one process acquires it, and the others wait.
Locks:
→
States: acquired / released.
Monitors:
→
Structures that combine data and procedures in automatic exclusion.
Related Concepts
Critical section:
Part of the code that accesses shared resources
Semaphores
Non-negative integer counter used for synchronization.
Types
Binary semaphore (mutex):
Values 0 or 1 → Mutual exclusion.
Counter semaphore:
Controls multiple instances of a resource.
Basic Operations
wait (P):
Requests access; blocks if the resource is unavailable.
signal (V):
Releases the resource; notifies waiting processes.
Advantages
Controls orderly access to shared resources.
Disadvantages
Improper use may cause crashes or racing conditions
Classic Synchronization Problems
Producer-Consumer
Producers place data into a buffer. Consumers remove data.
Challenge: prevent the buffer from filling up or running out.
Reader-Writer
Readers only read; writers modify.
Challenge: allow multiple readers, but exclusive writing.
Dining Philosophers
Philosophers share resources.
Challenge: avoid mutual obstruction.
Smokers
Agent places ingredients; smokers must wait their turn.
Challenge: Correct timing between agent and smokers.
Monitors
A structure that combines data and procedures with access control.
Features
Encapsulated data: Access only through monitor procedures.
Automatic mutual exclusion: Only one active process within the monitor.
Condition variables: These allow you to wait for and signal events.
Operations
Entry / Exit:
Controlled entry and exit to the monitor.
Wait / Signal / Broadcast:
Condition management for synchronization.
Advantages
They simplify concurrent programming and reduce errors.
Message Passing
Comunicación entre procesos mediante envío y recepción de mensajes (sin compartir memoria).
Types of communication
Synchronous:
The sender waits for reception.
Asynchronous:
The sender continues without waiting.
Elements
Communication Channels:
Direct or indirect (message queues).
Queued Messages:
Stored until the receiver is ready.
Advantages
Avoid racing conditions.
Ideal for distributed systems.
Examples
Client-server architecture.
Messaging and queuing systems.