Performance of select/poll vs asynchronous I/O

后端 未结 2 1694
死守一世寂寞
死守一世寂寞 2021-02-02 04:44

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 asynchron

2条回答
  •  孤独总比滥情好
    2021-02-02 05:20

    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.

    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.

    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 :))

提交回复
热议问题