I have been engaged in php-web development and have never touched on multithreading and asynchronous models. Recently, I need to use swoole to develop a websocket server. I have seen many concepts related to multithreading and asynchronous models in this document. how can I systematically learn this knowledge? I have been engaged in php-web development and have never touched on multithreading and asynchronous models. Recently, I need to use swoole to develop a websocket server. I have seen many concepts related to multithreading and asynchronous models in this document. how can I systematically learn this knowledge?
Reply content:
I have been engaged in php-web development and have never touched on multithreading and asynchronous models. Recently, I need to use swoole to develop a websocket server. I have seen many concepts related to multithreading and asynchronous models in this document. how can I systematically learn this knowledge?
I personally think that there is nothing to learn systematically. I just need to go to the corner to reflect on it.
Many of you will encounter similar problems. The root cause is that your thinking model is synchronous, and the conversion of thinking models cannot be solved by external forces. Asynchronous thinking is closer to reality. In reality, all actions can be explained in asynchronous mode, that is, although you do not know what will happen in the future, however, the measures I have taken for specific things are positive (such as going to the toilet). That is to say, the asynchronous model is deduced by callback, the synchronization model is often used to reverse derive its law based on the predicted conditions and the specified results.
Multithreading is relatively simple and thread management is enough.
Note: the method of thinking has nothing to do with whether the final code is synchronous or asynchronous. However, if the method of thinking is incorrect, it is difficult to understand the ideas represented by the code of the asynchronous model, thus forming a learning disability.