학교공부/컴퓨터네트워크

[컴퓨터네트워크] 기말고사 정리본 (4)

yunmap 2017. 12. 17. 16:26

network layer : logical communication between hosts

transport layer : logical communication between processes

UDP : unreliable, unordered delivery (best-effort), connectionless (user-datagram-protocol)

- no connection establishment (which can cause delay), simple, small segment header, no congestion control)

- multimedia application streaming에 사용된다. (loss tolerant but rate sensitive)

(DNS, SNMP, RTP(real time protocol))

- reliability를 추가하려면 application에 추가해야 함.

TCP : reliable, in-order delivery (transmission control protocol)

(1) congestion control (internet)

considers the congestion level of the current network or route.

dynamically adjust the transmission rate (network_router에 overflow가 발생하지 않도록)

(2) flow control (RX)   

consider current state of receiver buffer. (buffer에 overflow가 일어나지 않도록)

(3) connection setup

- connection oriented, P2P (one sender, one receiver)

- reliable, in-order delivery

- Byte stream delivery

- full duplex

pipelining : ACK 가 올 때까지 transmit을 중단하고 기다리면 (stop and wait) throughput이 엄청 낮아진다.

ACK 올 때까지 기다리지 말고, network에 packet을 밀어 넣자! 'keep the pipe full'

pipe = outstanding data (TX에서 전송했으나 RX에 아직 도착하지 않은 패킷)

pipeline을 통해 data를 너무 빠르게 전송하게 되면 Receiver 또는 Network가 그만한 data를 받을 준비가 안 된 경우가 있음. -> control이 필요하다.

 

flow control의 원인 :

(1) finite buffer size at the receiver

(2) finite processing speed at the receiver (application layer가 transport layer의 packet을 absorb 하는데 시간이 걸린다.)

해결 : sliding window flow control (=protocol)

물론, sender의 buffer에도 sender의 application layer에서 추가로 전송해야 할 데이터들이 내려올 수 있음.

 

Window

sender : maximum size of data that can be transmitted without ACK

last byte acked : ack가 아직 안온 것들 중 첫 번째 Byte

last byte sent : last outstanding data (전송된)

last byte written : by upper layer

acked <= sent

sent <= written

receiver : size of remaining buffer space

last byte read : by upper layer

next byte expected

last byte received (may be out of order)

last byte read < next byte expected

next byte expected <= last byte received + 1

out of order packet을 버리지 않고, ACK의 seq num은 cumulative until the last received byte that is in order)

retransmit : last acked packet부터 쭉 다시 보낸다. (receiver는 겹치는 packet은 버려버림)

ACK가 한동안 안 오는 이유 : transmitted segment를 잃어버려서, ACK가 잃어버려서

-> timeout 내에 오지 않으면 어쨌든 둘 다 retransmit 이 일어난다.

-> timeout이 RTT와 유사해야 하지만, RTT보다 작으면 안 되고, RTT는 계속 바뀐다.

Adaptive retransmission : how to deal with changing RTT?

timeout이 너무 짧으면 premature timeout (unnecessary retransmission)

timeout이 너무 길면 slow reaction to segment loss

variance가 클수록 safety margin이 커져야 한다.

timeout = estimate + 4 deviation

estimated n = (1-a) estimated n-1 + a sample n (Actually measured)

 

Congestion control : end-end control (no network assistant) - host has to guess whether the network is congested

congestion is implicitly signaled by a packet loss (== retransmission)

congestion이 발견되면 transmission의 속도를 줄인다. - CongWin이라는 새로운 window 등장.

effective window = min (CongWin, advertised window)

CongWin은 dynamic.

loss event = timeout or 3 duplicate ACKs

TCP sender reduces rate after loss event

AIMD, slow start, conservative after timeout events

AIMD : additive increase multiplicative decrease

loss event 발생하면 congWin을 반으로 줄인다.

그 전까진 congWin을 1 MSS 만큼씩 모든 RTT에 올린다.

TCP = elastic traffic 

나 말고 다른 node도 pipe를 이용해서 rate를 떨어트린다고 무조건 congestion이 해결되는 것이 아니다.)

slow start : connection이 begin 하면 Congwin=1 MSS. 그리고 ACK 받을 때마다 double 해준다.

initial rate = MSS / RTT (available bandwidth는 이것보다 훨씬 클 수 있음.)

Refinement

3 dup ACK : congWin을 반으로 줄이고, congWin은 linear 하게 증가한다.

timeout : CongWin이 1로 set 되며, window가 exponential 하게 증가하고, threshold 만나면 linear 하게 증가한다.

threshold : timeout 발생 시점의 절반.

CongWin 이 threshold보다 낮고, sender가 slow start phase면 congWin은 exponential하게 증가한다.

CongWin 이 threshold보다 높고, sender가 congestion-avoidance phase면 congWin은 linear하게 증가한다.

triple duplicate ACK가 발생하면, threshold는 Congwin/2로 되고, Congwin은 threshold로 설정된다.

timeout이 발생하면 Threshold는 CongWin/2로 되고, CongWin은 1 MSS가 된다.

TCP fairness : if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K