Computer synchronization and asynchronous

Synchronize

Definition:
Synchronization means that when a process is executing a request, if the request takes a while to return information, then the process will wait until it receives the return information before continuing to execute.
It can be understood that the synchronization needs to be waited, and the next step can be continued after the previous step is completed.
It is generally used for programs with relatively strong flow, such as user login, and the system can only be logged in after the user has been authenticated.
Features:
Synchronization is a blocking mode;
synchronization is executed in order, after executing one and then executing the next, you need to wait and coordinate operation;

asynchronous

Asynchronous means that the process does not need to wait forever, but continues to perform the following operations, regardless of the status of other processes. When a message returns, the system will notify the process for processing, which can improve the efficiency of execution.
Asynchronous does not need to wait, regardless of the state of other processes, it can be executed directly. Such as loading a page.
Features:
Asynchrony is a non-blocking mode, no need to wait;
asynchronous is independent of each other, in the process of waiting for an event, continue to do your own thing, do not need to wait for the completion of the event before working. Threads are a way of asynchronous implementation.

Advantages and disadvantages:
synchronization can avoid deadlocks and read dirty data. Generally, when sharing a certain resource, if everyone has the right to modify and modify a file at the same time, it may cause one to read the content that the other person has deleted, and there will be an error, and synchronization will not go wrong. However, synchronization needs to wait for the end of resource access, which wastes time and is inefficient.
Asynchrony can improve efficiency, but has lower security.

Guess you like

Origin blog.csdn.net/weixin_42898315/article/details/110855741