Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit d6bd38d

Browse files
author
hack4code
committed
space
1 parent f6a3515 commit d6bd38d

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

_posts/2013-08-20-mtsig.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2013-08-20 21:00:00
55
categories: c multithread
66
---
77
8-
###信号与执行上下文
8+
### 信号与执行上下文
99
* 执行过程中由系统生成的同步信号 : SIGPIPE SIGSEGV SIGPIPE
1010
信号会在产生异常的线程的上下文中执行
1111

@@ -16,11 +16,11 @@ categories: c multithread
1616
系统会随机选择一个线程处理信号,处理结果会影响所有线程
1717

1818

19-
###信号处理的方法
19+
### 信号处理的方法
2020
1. sigaction
2121
sigaction可以注册用户自定义的信号处理函数。要注意的是在信号处理函数中使用多线程的同步相关的函数,结果是为定义的,所以要慎重。
2222

2323
2. pthread_sigmask将信号阻塞,然后用sigwait在一个单独的线程中处理。
2424

25-
###示例代码:
25+
### 示例代码:
2626
github: [https://github.com/wartalker/c-small-programe/tree/master/mt-signal](https://github.com/wartalker/c-small-programe/tree/master/mt-signal)

_posts/2013-08-22-ipv6.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ date: 2013-08-22 19:50:00
55
categories: internet ipv6
66
---
77

8-
###IPv6地址类型
9-
> unicast:唯一地址,一个地址对应一个interface
10-
> anycast:一组地址,数据报文将传递给组中最近的一个interface
11-
> multicast:一组地址,数据报文将传递给组中的所有interface
8+
### IPv6地址类型
9+
> unicast: 唯一地址,一个地址对应一个interface
10+
> anycast: 一组地址,数据报文将传递给组中最近的一个interface
11+
> multicast: 一组地址,数据报文将传递给组中的所有interface
1212
13-
###IPv6地址划分
13+
### IPv6地址划分
1414
<table width=300px>
1515
<tr>
1616
<th>Address type</th>
@@ -42,7 +42,7 @@ categories: internet ipv6
4242
</tr>
4343
</table>
4444

45-
###Ipv6协议头
45+
### Ipv6协议头
4646

4747
<pre>
4848
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -65,6 +65,6 @@ categories: internet ipv6
6565
2. 分片信息以可选的形式存在option中,而不再像ipv4放在header中
6666
3. 地址长度由32bit变为128bit
6767

68-
###参考文档:
68+
### 参考文档:
6969
rfc2460: [Internet Protocol Version 6 (IPv6) Specification](http://tools.ietf.org/html/rfc3513)
7070
rfc3513: [Internet Protocol Version 6 (IPv6) Addressing Architecture](http://tools.ietf.org/html/rfc3513)

_posts/2013-09-12-tcp.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2013-09-12 23:04:00
55
categories: internet tcp
66
---
77

8-
###名词
8+
### 名词
99
RTO: retransmission timeout
1010
RTT: round-trip time
1111
SRTT: smoothed round-trip time
@@ -14,7 +14,7 @@ MSL: maximum segment lifetime
1414
SMSS: Sender Maximum Segment Size
1515

1616

17-
###Header <br /><br />
17+
### Header <br /><br />
1818

1919
<pre>
2020

@@ -38,7 +38,7 @@ SMSS: Sender Maximum Segment Size
3838

3939
</pre>
4040

41-
###状态图
41+
### 状态图
4242

4343
<pre>
4444
+---------+ ---------\ active OPEN
@@ -88,7 +88,7 @@ SMSS: Sender Maximum Segment Size
8888
</pre>
8989

9090

91-
###Timer
91+
### Timer
9292
1. retransmission
9393
tcp对发送的数据会启动一个timer,如果指定时间内没有收到发送数据对应的ACK,tcp会重新发送数据。timer根据RTT和重传的次数动态调整超时时间
9494
2. delay ACK
@@ -104,25 +104,25 @@ SMSS: Sender Maximum Segment Size
104104
7. connection
105105
tcp接到SYN连接请求回复SYN/ACK后,linux并没有为这些没完成三次握手的请求建立完整的tcp\_sock,而是以request\_sock放在处于listen状态的父tcp\_sock的队列中,而且有一个timer会定期扫描这些request\_sock,并清除一些长时间没有收到ACK的sock
106106

107-
###TIME_WAIT
107+
### TIME_WAIT
108108
tcp进入TIME_WAIT状态后,需要等待2MSL的时间才能关闭,主要有两个原因:
109109
1. 最后的ACK有可能丢失,这时对方可能会重新发送FIN,当收到新的FIN后,tcp要回复ACK,并重新启动timer
110110
2. 如果不等待直接关闭,这时有可能开启一个使用相同端口的新服务,而如果新tcp收到FIN,会发送RST,这样会给对方造成困扰
111111

112112

113-
###Congestion Control
113+
### Congestion Control
114114
Congestion Control主要用于通信路径的网络流量控制,不同于Flow Control需要考虑接收方的Buffer及处理速度,它控制的是通信路径中整个网络的流量,算法通过cwnd与ssthresh两个变量实现,目前主要有四种算法:
115115
1. Slow Start
116116
tcp启动时,为了避免过多的流量对网络造成拥塞,cwnd有一个初始的限定值,通常为一个SMSS,此后每收到一个ACK,cwnd会增加一个SMSS,直到cwnd>=ssthresh。Slow Start不止在启动时使用,当有重传发生时,cwnd会降到初始值,重新启动Slow Start
117117
2. Congestion Avoidance
118118
当cwnd>ssthresh时,tcp会启用Congestion Avoidance算法,这时cwnd增加的速率会降低,通常为SMSS*SMSS/cwnd
119-
3. Fast Retransmit
119+
3. Fast Retransmit
120120
当收到重复的ACK但是RTO还没有超时,这时tcp进入Fast Retransmit状态,重传丢失的报文,并重新设定cwnd与ssthresh的值
121121
4. Fast Recovery
122122
在tcp进入Fast Retransmit状态并重传报文后,tcp进入Fast Recovery状态,直至收到重传报文的ACK为止
123123

124124

125-
###参考文档:
125+
### 参考文档:
126126
rfc793: [Transmission Control Protocol](http://tools.ietf.org/html/rfc793)
127127
rfc1122: [Requirements for Internet Hosts -- Communication Layers](http://tools.ietf.org/html/rfc1122)
128128
rfc5681: [TCP Congestion Control](http://tools.ietf.org/html/rfc5681)

0 commit comments

Comments
 (0)