Explanation of Concurrency, Parallel, Serial, Synchronous, Asynchronous and Mutual Exclusion

1. Concurrency

Refers to the simultaneous execution of multiple instructions on the CPU within the same time period

In the operating system, several programs are in the stage of starting and running to running in a period of time, and they are all running on the same processor

2. Parallel

Refers to the simultaneous execution of multiple instructions on the CPU at the same time

In a single-processor multi-programming system, processes are executed alternately, showing a concurrent external characteristic. In a multi-processor system, processes can not only be executed alternately, but also overlapped; parallelism is simultaneous multi-programming. A concurrent event has the meaning of concurrency, but concurrency is not necessarily parallel, which means that concurrent events do not necessarily have to occur at the same time.

3. Serial

Only one task can be obtained and executed at a time, and the task can only continue after the subsequent tasks are executed.

4. Synchronization

Synchronization is sequential execution. After one execution is executed, the next one needs to be waited and coordinated.

The output of the previous process is used as the input of the latter process, and the second process must wait when the first process has no output. Information sent to each other by a group of concurrent processes with a synchronization relationship is called a message or event.

5. Asynchronous

Independent of each other, continue to do their own thing while waiting for an event, do not need to wait for this event to complete before working

Thread is a way to achieve asynchronous. Asynchronous means that the main thread that calls the method does not need to wait for the completion of another thread synchronously, so that the main thread can do other things. Asynchronous and multithreading are not an equal relationship. Asynchronous is the ultimate goal. , Multithreading is just a means for us to achieve asynchrony.

6. Mutual exclusion

The phenomenon of mutually exclusive use of critical resources between processes is called mutual exclusion.


The difference between asynchronous and synchronous. When io is waiting, synchronous will not be cut off, which is a waste of time. If it is a business that monopolizes the cpu, there is no difference between multi-line and single-line in the case of a single core. The benefits of multi-threading are relatively easy. The idea of ​​asynchronous switching is realized, because asynchronous programs are difficult to write. Multithreading itself is still completed synchronously, but it should be said that the efficiency is not as good as asynchronous. Moreover, multi-line is easy to write and relatively efficient.

Guess you like

Origin blog.csdn.net/weixin_46267139/article/details/131102431