admin管理员组

文章数量:1125335

I recently figured out that there are differences between non-blocking communication and asynchronous communication. I thought that they are same things.

And then I was introduced to the concept of event loop.

but I have some confusions and questions about this topic. I visited all related topics and questions but I could not find my answers. these are my questions:

1- Is the event loop inherently used to implement asynchronous communication or non-blocking communication? if we have an event loop like this (with single thread), then we have a non-blocking communication or asynchronous communication? I know that in a non-blocking+asynchronous communication, event loop helps but I want know that event loop by nature implements what type of communication.

2- If the answer to the above question is that the communication is non-blocking, then whenever someone says that an event loop is used in an asynchronous communication, can we immediately conclude that that communication is also non-blocking?

3- We see that the event loop has only one thread. It can be concluded that "single-threaded asynchronous communication" must use the event loop, and since it uses the event loop, then this asynchronous communication must also be non-blocking?

In general, the idea that has formed in my mind is that a non-blocking communication has only one thread and is implemented with an event loop, and an asynchronous communication is implemented with multiple threads.

And if someone says that our asynchronous communication has only one thread, I assume that then it must also be a non-blocking communication and an event loop is used in it. And if someone says that our non-blocking communication has implemented by multiple threads, then I assume that it must also be a asynchronous communication (and we have some promises like Future and CompletableFuture or something like that maybe.)

I am completely confused. help me please.

本文标签: