In my Linux column in
We had talked about multi-process programming , inter-process communication and multi-threaded programming
In which I made a detailed explanation, and also comes with source code
In the meantime, there is an important concept, we need to brought out individually concerned, it is mutually exclusive and synchronization
We know that multiple processes / threads access the same shared resources when
Cause data chaos
So it only requires mutual exclusion and synchronization mechanisms to protect
So this one we need to put this concept clear rationale
1, that process / thread mutex and synchronization in the end what is it?
Process synchronization and mutual exclusion and process synchronization and mutual exclusion is a meaning.
Exclusive : it is a resource while allowing only a visitor to access it, is unique and exclusive. But visitors can not restrict access to exclusive order of resources, that access is not ordered.
Synchronization : is on the basis of mutually exclusive (in most cases), the visitor achieve orderly access to resources through other mechanisms. In most cases, mutual exclusion synchronization has been achieved, especially in the case of writing all resources must be mutually exclusive. Rarely is one that can allow visitors to simultaneously access multiple resources.
----------------
excerpt of the original link: https: //blog.csdn.net/qq_41822235/article/details/85838959
2, the process of mutual exclusion and synchronization mechanisms:
Local applications : interprocess communication in the ( shared memory )
Tool to achieve : semaphore set
3, thread mutual exclusion and synchronization mechanisms:
Local applications : multi-threaded programming
Tool to achieve : mutex semaphores condition variables