Synchronization is: all operations are completed before returning to the user; in this way, the user waits online for too long, giving the user a feeling of being stuck; in this case, the user cannot close the interface. If it is closed, the migration process is interrupted. Asynchronous means: putting the user request into the message queue and feeding it back to the user. The system migration program has been started and you can close the browser.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Synchronization:
The idea of synchronization is: all operations are completed before they are returned to the user. In this way, the user waits online for too long, giving the user a stuck feeling (that is, when the system is being migrated, if you click Migrate, the interface will not move, but the program is still executing, giving the user a stuck feeling). In this case, the user cannot close the interface. If it is closed, the migration process will be interrupted.
Asynchronous:
Put the user request into the message queue and feed it back to the user. The system migration program has been started and you can close the browser. Then the program slowly writes to the database. This is asynchronous. But the user does not feel stuck and will tell you that the system has responded to your request. You can close the interface.
Synchronization and asynchronousness are relative.
Synchronization is equivalent to when the client sends a request to the server. While waiting for the server to respond to the request, the client does not Do other things. When the server is finished, it returns to the client. In this case, the client needs to wait forever. It will be unfriendly to users.
Asynchronous means that when the client sends a request to the server, while waiting for the server to respond, the client can do other things, which saves time and improves efficiency.
It exists for a reason. Although asynchronous is good, some problems need to be solved with synchronization. For example, for some things we need to get the returned data for operation. These cannot be solved by asynchronous.
If you want to read more related articles, please visit PHP Chinese website! !
The above is the detailed content of What is the difference between asynchronous and synchronous. For more information, please follow other related articles on the PHP Chinese website!