Page 55 - Handout of Computer Architecture (1)..
P. 55
Process A → Read 10
Process B → Read 10
Process A → Write 11
Process B → Write 11
Final value = 11
Correct value should be: 12 This error happens because of race condition.
2.13.6 Requirements for Synchronization
A correct solution must satisfy 3 conditions.
2.13.7 Mutual Exclusion
Only one process can enter the critical section.
2.13.8 Progress
If no process is inside the critical section, another process should not wait forever.
2.13.9 Bounded Waiting
A process should not wait indefinitely. There must be a limit on waiting time.
2.13.10 Synchronization Mechanisms
1. Locks (Mutex) A lock protects a resource.
Example:
lock
critical section
unlock
Only the process holding the lock can execute the critical section.
Example
lock(mutex)
balance = balance + 100
unlock(mutex)
2.13.11 Where Synchronization is Used
Synchronization is important in:
55

