选择/ poll的性能VS异步I / O [英] Performance of select/poll vs asynchronous I/O

查看:251
本文介绍了选择/ poll的性能VS异步I / O的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从性能的角度来看,哪一个更好?选择/投票或异步I / O?我早期的IM pression是选择/民意调查一再询问数据的内核,而异步I / O依赖于内核的数据可用性的通知。然而,我注意到,选择/民调还依赖于内核通知。所以,我认为从性能的角度来看都是一样的。唯一的区别是,选择/ poll的块,而异步I / O没有。我是正确还是我失去了一些东西?

From a performance standpoint, which one is better? select/poll or asynchronous I/O? My earlier impression was select/poll repeatedly asks the kernel for data, whereas asynchronous I/O relies on kernel's notification for data availability. However, I have noticed that select/poll also relies on kernel notifications. So, I believe from a performance standpoint both are same. The only difference is that select/poll blocks whereas asynchronous I/O does not. Am I correct or am I missing something?

推荐答案

选择/民调还依赖于准备filedeskriptors内核通知。但选择/投票缺点是它们尽快阻止他们被称为因为系统调用处理程序在内核空间运行。

select/poll also relies on kernel notification for ready filedeskriptors. But the disadvantage of select/poll is that they block as soon they are called because the Systemcall-Handler runs in the Kernel-Space.

实时异步I / O是通过libaio的(在Linux上)和IOCP在Windows上实现的。据我所知,他们不阻止DER用户空间调用进程/线程,并允许他们真正的重叠I / O。

Real asynchronous I/O is achieved via LibAIO (on Linux) and IOCP on Windows. As far as i know they dont block the calling process/thread in der User Space and they allow real overlapped I/O.

这意味着异步非阻塞I / O(libaio的&安培; IOCP)更快,因为它不会阻塞调用线程,他们提供真正的重叠I / O。选择/民调也是异步的,但他们是异步阻止。顺便说一句,并选择和poll其他具体问题的困扰,使他们不能扩展那么好。

That means asynchronous Non Blocking I/O (LibAIO & IOCP) is faster, because it does not block the calling Thread and they allow real overlapped I/O. Select/poll are also asynchronous, but they are Asynchronous Blocking. And btw select and poll suffer from other specific problems so that they cant scale that well.

希望我能帮助ü。 (我在这一个新手也:))

Hope i could help u. (I am a newbie on this too :))

这篇关于选择/ poll的性能VS异步I / O的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆