![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
IO
文章平均质量分 58
三斤牛仔
前阿里,网易技术专家。目前在创业公司帮助企业完成数字化转型
展开
-
深入了解LINUX下IO模式(一)——一些基本概念
网上看了好多IO,NIO的文字,参差不齐,每篇总是差一两个点没有讲到,所以这里对于我自己理解的做一个总结,也许有不对的地方。 1,基本概念 1.1)同步/异步,阻塞/非阻塞 同步异步主要针对C端: 所谓同步,就是在c端发出一个功能调用时,在没有得到结果之前,该调用就不返回。也就是必须一件一件事做,等前一件做完了才能做下一件事。 异步的概念和同步相对。当c端一个异步过程调用...原创 2017-02-24 19:52:57 · 72 阅读 · 1 评论 -
深入了解LINUX下IO模式(一)——一些基本概念
原创 2017-02-24 19:52:57 · 149 阅读 · 0 评论 -
深入了解LINUX下IO模式(二)——什么是面向流,什么是面向缓冲区
ead(byte b[], int off, int length, int timeout) throws IOException { int n; // EOF already encountered if (eof) { return -1; } // connection reset if (impl.isConnectionReset()) { throw new SocketException("Connection reset");原创 2017-02-24 20:07:02 · 1377 阅读 · 1 评论 -
深入了解LINUX下IO模式(三)——Linux下的select,poll,epoll
t *exceptfds, struct timeval *timeout); select方式会监视所有的readFD,writeFD,exceptFD select的一 个缺点在于单个进程能够监视的文件描述符的数量存在最大限制 poll: int poll (struct pollfd *fds, unsigned int nfds, int timeout); poll方式中pollfd没有最大数量限制 但是! select和poll没有太大区别,都是轮训所有的fd/pollfd原创 2017-02-24 20:17:46 · 203 阅读 · 1 评论 -
深入了解LINUX下IO模式(一)——NIO及reactor模式
ngQueue<>(); private Object lock = new Object(); public List<Event> select() { return select(0); } List<Event> select(long timeout) { if (timeout > 0 ) { if (queue.isEmpty()) {原创 2017-03-02 10:25:54 · 170 阅读 · 0 评论