Cola_Forever 2022-08-06 19:07:14 阅读数:241
Synchronous and asynchronous focus on the message communication mechanism.
1. The so-called synchronization means that when a call is issued, the call will not return until the result is obtained. But once the call returns, theThe return value is returned; in other words, the caller actively waits for the result of the call;
2. Asynchronous is the opposite. After the call is issued, the call returns directly, so no result is returned; in other words,When an asynchronous
procedure call is made, the caller does not get the result immediately; instead, after the call is made, the callee notifies the caller through status, notification, or handles the call through a callback function.
In addition, we recall that when we talked about multi-process and multi-threading, we also mentioned synchronization and mutual exclusion. The synchronous communication and synchronization between processes here are completely unwanted concepts.
1. Process/Thread synchronization is also a direct constraint relationship between processes/threads. It is two or more threads established to complete a certain task. This thread needs to coordinate their work order at certain positions to wait and transmit information.Constraints. Especially when accessing critical resources**
Blocking and non-blocking focus on the state of the program while waiting for the call result (message, return value).
Blocking call means that the current thread will be suspended before the call result is returned. The calling thread only hasIt will not return until the result is obtained.
A non-blocking call means that the call will not block the current thread until the result is not immediately available.
copyright:author[Cola_Forever],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/218/202208061856509312.html