Skip to content

Commit 8585b1b

Browse files
committed
Creates assets/libevent-2-阻塞02.png
Auto commit by GitBook Editor
1 parent 154a17f commit 8585b1b

9 files changed

+61
-2
lines changed

2-epoll.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# 2 EPOLL
22

3+
##
4+

21-流-io.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## 2.1 流?I\/O操作\/阻塞
2+
3+
### 2.1.1 流
4+
5+
* 可以进行I\/O操作的内核对象
6+
* 文件、管道、套接字……
7+
* 流的入口:文件描述符\(fd\)
8+
9+
## 2.1.2 I\/O操作
10+
11+
![](/assets/libevent-2-io操作01.png)
12+
13+
---
14+
15+
![](/assets/libevent-2-io操作02.png)
16+
17+
---
18+
19+
所有对流的读写操作,我们都可以称之为IO操作。
20+
21+
> ### 那么当一个流中再没有数据,read的时候,或者说在流中已经写满了数据,再write,我们的IO操作就会出现一种现象,就是阻塞现象。
22+
23+
## 2.1.2 阻塞
24+
25+
26+
27+
![](/assets/libevent-2-阻塞01.png)
28+
29+
---
30+
31+
![](/assets/libevent-2-阻塞02.png)
32+
33+
---
34+
35+
* 阻塞等待
36+
37+
空出大脑可以安心睡觉。(不占用CPU宝贵的时间片)
38+
39+
40+
* 非阻塞,忙轮询
41+
42+
浪费时间,浪费电话费,占用快递员时间(占用CPU,系统资源)
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+

3-epoll和reactor.md

Whitespace-only changes.

4-libevent简单服务器.md

Whitespace-only changes.

SUMMARY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [Libevent深入浅出](README.md)
44
* [1 Libevent官方](chapter1.md)
55
* [2 epoll](2-epoll.md)
6-
* 3 epoll和reactor
7-
* 4 libevent简单服务器
6+
* [2.1 流-IO操作-阻塞](21-流-io.md)
7+
* [3 epoll和reactor](3-epoll和reactor.md)
8+
* [4 libevent简单服务器](4-libevent简单服务器.md)
89

assets/libevent-2-io操作01.png

20.7 KB
Loading

assets/libevent-2-io操作02.png

15.1 KB
Loading

assets/libevent-2-阻塞01.png

43.7 KB
Loading

assets/libevent-2-阻塞02.png

123 KB
Loading

0 commit comments

Comments
 (0)