Netty为什么要使用`多生产者单消费者`队列?

Why does Netty use `Multiple producer single consumer` Queue?

Netty-4的线程模型是:

每个EventLoop(Thread)都有自己的taskQueue,这个queue只被这个EventLoop(Thread)操作。那么EventLoop的taskQueue是如何被操作的'multiple producer'?

因为您可以从 EventLoop 之外提交作品。例如,如果您从另一个线程调用 Channel.write(...),它将被分派到 EventLoop 进行处理。这意味着它需要放入 Queue,这要求它至少是 MPSC。