本文介绍了什么是事件驱动和异步的区别? epoll的AIO和之间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

事件驱动和异步经常被用作同义词。有没有两者有何区别?

Event-driven and asynchronous are often used as synonyms. Are there any differences between the two?

另外,是的epoll AIO 之间的区别?他们是如何结合在一起的?

Also, what is the difference between epoll and aio? How do they fit together?

最后,我读过很多次,AIO在Linux是可怕的坏了。它究竟是如何破?

Lastly, I've read many times that AIO in Linux is horribly broken. How exactly is it broken?

感谢。

推荐答案

活动是范式实现异步执行的一个。
但并非所有的异步系统使用的事件。这是关于这两种语义 - 一个是另一个超级实体

Events is one of paradigms to achieve asynchronous execution.But not all asynchronous systems use events. That is about semantic meaning of these two - one is super-entity of another.

和epoll的AIO使用不同的比喻:

epoll and aio use different metaphors:

epoll的是阻塞操作( epoll_wait()) - 您阻塞线程,直到一些事件发生,然后你调度事件在不同的过程/函数/分支机构的code。

epoll is a blocking operation (epoll_wait()) - you block the thread until some event happens and then you dispatch the event to different procedures/functions/branches in your code.

在AIO你通过你的回调函数(完成例程)的地址到系统并且有事情发生时,系统调用你的函数。

In AIO you pass address of you callback function (completion routine) to the system and the system calls your function when something happens.

与AIO问题是,你的回调函数code从系统的线程中运行等系统堆栈的顶部。与的几个问题,你可以想像。

Problem with AIO is that your callback function code runs from system thread and so on top of system stack. A few problems with that as you can imagine.

这篇关于什么是事件驱动和异步的区别? epoll的AIO和之间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 15:38