Concurrent multi-threaded parallel synchronous asynchronous

This blog that focused on concurrent, parallel, asynchronous, and understand the differences between each other multithreaded theory, hoping to understand bloggers insufficient to bring help in this regard.

Complicated by

In the operating system, refers to a time period has started several programs are in the running to run between finished and these processes

Sequence are run on the same processor. Two of concurrent relationships are synchronous and mutually exclusive

Exclusive

Interprocess mutually exclusive use of critical resources of the phenomenon, called mutually exclusive.

Synchronize

The relationship between the process of critical resources are not mutually exclusive relationship, but a relationship of interdependence. Further explanation: that the previous process output after as a process input , when a process is not the first output of the second process must wait . Information about a set of concurrent processes with synchronous relationship with each other is called sending messages or events.

Wherein there are concurrent concurrent pseudo and true concurrency, concurrent pseudo refers concurrent single-core processor, means true concurrent concurrent multi-core processor.

parallel

Multiprogramming system, the process is a single-core processor alternately performed , showing one kind of concurrent special external;

In the multi-core processor, the process can only alternately performed , but also overlapping manner . Program on multi-core processors available parallel processing. Thus understood, for the purposes of a parallel multi-core processor.

Parallel multiple concurrent events occurring simultaneously, have the meaning concurrent, but not necessarily concurrent parallel, it also does not have to mean the same moment between concurrent events.

The benefits of multi-core, is that you can do things at the same time, the single-core and completely different.

Multithreading

Multi-threaded programming is the concept of logical layer, which is a piece of code in the process run concurrently. Multi-threaded execution switching between threads can be achieved.

The benefits of multi-threading, easier to implement the idea of ​​asynchronous switching, asynchronous because the program difficult to write. Multi-threaded process itself or in synchronization is complete, it should be said that the efficiency ratio is not as asynchronous. And it is easy to write multi-threaded, relatively high efficiency.

Multi-thread synchronization reasons:

In multithreaded programs, the synchronization can control access to shared resources. Without synchronization, when a Java thread when you modify a shared variable, or use another thread is updating the same variable, so easily lead to program error results.

asynchronous

Asynchronous and synchronous is relative, synchronous execution order is for, do a complete re-implementation of a need to wait, coordinated operation.

Asynchronous is independent of each other, continue to do their own thing while waiting for an event, you do not need to wait for this event after the completion of the work.

Thread is to achieve a way asynchronous. Asynchronous method call is to let the main thread does not need to wait for the completion of another thread synchronization, which allows the main thread to do other things.

And asynchronous multi-threading is not an equal relationship, the ultimate goal is asynchronous, multi-threaded but we realize a means asynchronous. When a call is asynchronous requests to return to the caller, but the caller without waiting for their results and can do other things. Asynchronous multi-threading technology can be used or another process is to be handled.

Guess you like

Origin blog.csdn.net/weixin_42236165/article/details/92091076
Recommended