Process synchronization is the task of organizing the access of
several concurrent processes to shared (i.e. jointly used) resources
without causing any conflicts. The shared resources are most often
memory locations (shared data) or some hardware. Process
synchronization can be divided into two subcategories:
- Synchronizing competing processes:
- Several processes compete
for one exclusive resource. This is solved by one of the mutual
exclusion mechanisms.
- Synchronizing cooperating processes:
- Several processes have
to notify each other of their progress so e.g. common results can be
passed on. The consumer producer problem is an example. This problem
is often solved with semaphores or messaging.
In both subcategories deadlocks or race conditions might occur if
the problem is not solved carefully (which you normally only notice
after the fact).