1
clowwindy 2012-09-26 16:01:31 +08:00 1
推荐读一下 http://www.remlab.net/op/nonblock.shtml
Regular files are always readable and they are also always writeable. This is clearly stated in the relevant POSIX specifications. I cannot stress this enough. Putting a regular file in non-blocking has ABSOLUTELY no effects other than changing one bit in the file flags. |
2
zhangxiao OP @clowwindy 我刚刚读了一下,但是还有疑问,想确认一下我的理解:
按照文章作者的意思,磁盘读写也是会出现忙碌的,也会造成用户能感觉到的延时甚至卡死。但是使用non-blocking也不会有任何帮助。 只有尝试建立一个单独的线程去处理这个文件的读写,才能避免主线程被阻塞。 如果上述理解是对的,那么nodejs里的对文件的异步IO又是怎么实现的? |
3
phuslu 2012-09-26 20:42:00 +08:00
torndao不能,gevent差强人意(gevent 1.0引入的fileobject)
nodejs不错(libeio) 值得关注的还有libaio |