Understanding of synchronization and mutual exclusion

There are two main types of relationships between intersecting processes, synchronization and mutual exclusion.

Mutual exclusion: refers to several program fragments scattered among different processes. When a process runs one of the program fragments, other processes cannot run the program fragment, and can only run it after the process has finished running the program fragment. .

Synchronization: refers to a number of program fragments scattered among different processes, and their operation must be run in strict accordance with a prescribed sequence, which depends on the specific task to be completed.

Summarize:

        Mutual exclusion: It means that only one visitor is allowed to access a resource at the same time, which is unique and exclusive. But mutual exclusion cannot limit the order in which visitors access resources, that is, the access is unordered.

  Synchronization: On the basis of mutual exclusion (in most cases), the orderly access of visitors to resources is achieved through other mechanisms. In most cases synchronization already implements mutual exclusion, in particular all writes to resources must be mutually exclusive. In a few cases, it is possible to allow multiple visitors to access the resource at the same time.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326660295&siteId=291194637
Recommended