Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy.

Similar presentations


Presentation on theme: "CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy."— Presentation transcript:

1 CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy

2 Transport Layer 2 Chapter 3 outline  Transport-layer services  Multiplexing and demultiplexing  Connectionless transport: UDP  Principles of reliable data transfer  Connection-oriented transport: TCP  segment structure  reliable data transfer  flow control  connection management  Principles of congestion control

3 Reliable Data Transfer 1-3 Reliable Channel Unreliable Channel Application Layer Transport Layer Network Layer rdt_send() udt_send() rdt_rcv() deliver_data() Provided Service Service Implementation

4 1-4 Transport Layer Protocol rdt 1.0: Perfectly Reliable Channel Sender Receiver Transport Layer at sender accepts packet from App Layer and sends it to Network Layer Transport Layer at receiver extracts packet from Network Layer and delivers it to App Layer Waiting

5 1-5 Transport Layer Protocol rdt 2.0 (stop-and-wait): Channel with Bit Errors Sender Receiver Transport Layer at sender accepts packet from App Layer and sends it to Network Layer Transport Layer at receiver extracts packet from Network Layer and delivers it to App Layer Waiting Errors Waiting for ACK or NAK Send ACK or NAK

6 1-6 Transport Layer Protocol rdt 2.0 (stop-and-wait): Channel with Bit Errors Sender Receiver Transport Layer at sender accepts packet from App Layer and sends it to Network Layer Transport Layer at receiver extracts packet from Network Layer and delivers it to App Layer Waiting for Call 0 Waiting for 0 Errors Waiting for ACK or NAK Send ACK or NAK Waiting for Call 1 Waiting for 1

7 1-7 Transport Layer Protocol rdt 2.0 (stop-and-wait): Channel with Bit Errors Sender Receiver Transport Layer at sender accepts packet from App Layer and sends it to Network Layer Transport Layer at receiver extracts packet from Network Layer and delivers it to App Layer Waiting for Call 0 Waiting for 0 Errors and Loss Waiting for ACK 0 or NAK 0 Send ACK 0 or NAK 0 Waiting for Call 1 Waiting for 1

8 1-8 Transport Layer

9 Pipelined protocols Pipelining: sender allows multiple, “in-flight”, yet-to-be- acknowledged pkts  range of sequence numbers must be increased  buffering at sender and/or receiver  Two generic forms of pipelined protocols: go-Back-N, selective repeat

10 Pipelining: increased utilization 1-10

11 Pipelining Protocols: Go-back-N  sender: up to N unACKed pkts in pipeline  receiver: only sends cumulative ACKs  doesn’t ACK pkt if there’s a gap  sender: has timer for oldest unACKed pkt  if timer expires: retransmit all unACKed packets

12 Pipelining Protocols: Go-back-N

13 Pipelining Protocols: Selective Repeat  sender: up to N unACKed packets in pipeline  receiver: ACKs individual pkts  sender: maintains timer for each unACKed pkt  if timer expires: retransmit only unACKed packet

14 Pipelining Protocols: Selective Repeat

15 Transport Layer 15 TCP: Overview  full duplex data:  bi-directional data flow in same connection  MSS: maximum segment size  connection-oriented:  handshaking (exchange of control msgs) init’s sender, receiver state before data exchange  flow controlled:  sender will not overwhelm receiver  point-to-point:  one sender, one receiver  reliable, in-order byte steam:  no “message boundaries”  pipelined:  TCP congestion and flow control set window size  send & receive buffers

16 Transport Layer TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number Receive window Urg data pointer checksum F SR PAU head len not used Options (variable length) URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) # bytes rcvr willing to accept counting by bytes of data (not segments!) Internet checksum (as in UDP)

17 Transport Layer 17 TCP seq. #’s and ACKs Seq. #’s:  byte stream “number” of first byte in segment’s data ACKs:  seq # of next byte expected from other side  cumulative ACK Q: how receiver handles out- of-order segments  A: TCP spec doesn’t say, - up to implementer Host A Host B Seq=42, ACK=79, data = ‘C’ Seq=79, ACK=43, data = ‘C’ Seq=43, ACK=80 User types ‘C’ host ACKs receipt of echoed ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ time simple telnet scenario

18 Transport Layer 18 TCP reliable data transfer (RDT)  TCP creates RDT service on top of IP’s unreliable service  pipelined segments  cumulative ACKs  TCP uses single retransmission timer  retransmissions are triggered by:  timeout events  duplicate ACKs  initially consider simplified TCP sender:  ignore duplicate ACKs  ignore flow control, congestion control

19 TCP sender events: data rcvd from app:  create segment with seq #  seq # is byte-stream number of first data byte in segment  start timer if not already running (think of timer as for oldest unACKed segment) timeout:  retransmit segment that caused timeout  restart timer ACK rcvd:  if acknowledges previously unACKed segments  update what is known to be ACKed  start timer if there are outstanding segments

20 TCP: retransmission scenarios Host A Seq=100, 20 bytes data ACK=100 time premature timeout Host B Seq=92, 8 bytes data ACK=120 Seq=92, 8 bytes data Seq=92 timeout ACK=120 Host A Seq=92, 8 bytes data ACK=100 loss timeout lost ACK scenario Host B X Seq=92, 8 bytes data ACK=100 time Seq=92 timeout

21 TCP retransmission scenarios (more) Host A Seq=92, 8 bytes data ACK=100 loss timeout Cumulative ACK scenario Host B X Seq=100, 20 bytes data ACK=120 time

22 Transport Layer 22 Fast Retransmit  time-out period often relatively long:  long delay before resending lost packet  detect lost segments via duplicate ACKs.  sender often sends many segments back-to-back  if segment is lost, there will likely be many duplicate ACKs for that segment  If sender receives 3 ACKs for same data, it assumes that segment after ACKed data was lost:  fast retransmit: resend segment before timer expires

23 Host A timeout Host B time X resend seq X2 seq # x1 seq # x2 seq # x3 seq # x4 seq # x5 ACK x1 triple duplicate ACKs

24 TCP Flow Control  receiver side of TCP connection has a receive buffer:  speed-matching service: matching send rate to receiving application’s drain rate  guarantees receiver’s buffer doesn’t overflow r app process may be slow at reading from buffer  receiver: advertises unused buffer space by including rwnd value in segment header  sender: limits # of unACKed bytes to rwnd sender won’t overflow receiver’s buffer by transmitting too much, too fast flow control IP datagrams TCP data (in buffer) (currently) unused buffer space application process rwnd RcvBuffer

25 TCP Congestion Control Transport Layer  Sliding Window Protocol  Sender maintains a congestion window (cwnd), in addition to the receiver’s window (rwnd) advertised in ACK Allowed-window = min(cwnd, rwnd)  If no congestion: Allowed-window = rwnd  Packet loss is interpreted as congestion occurrence: reduce congestion window size.

26 Transport Layer 1-26  Congestion control is performed at the sending host, using feedback from the destination host (acknowledgments)  The sender keeps increasing the congestion window cwnd until something happens, then it starts to react  The original version of TCP, called TCP Tahoe, had only two phases: slow start (exponential increase) and congestion avoidance (linear increase)  New version of TCP, called TCP Reno, has three states: slow start, congestion avoidance, and fast recovery (to recover from errors faster) TCP Congestion Control

27 1-27  Initially cwnd = 1 MSS, ssthresh = 64KB. Thus, sending rate = 1 MSS/RTT  The sender sends one segment and waits for ACK  For every ACK received, increase cwnd by one (exponential increase)  For how long? Slow Start

28 TCP Tahoe 1-28  Exponential increase keep happening until one of 3 things occur: cwnd ≥ ssthresh, OR timeout event occurs, OR 3 duplicate ACKs are detected  If cwnd ≥ ssthresh  go to congestion avoidance state directly  If timeout or 3 duplicate ACKs  set cwnd = 1, ssthresh = cwnd/2, Increase exponentially until cwnd ≥ ssthresh, then go to congestion avoidance state  In congestion avoidance: increase cwnd by 1/cwnd for every new ACK received (linear increase)  How long do we stay in congestion avoidance  until either a timeout or 3 duplicate ACKs are detected  Reaction: cwnd = 1, ssthresh = cwnd/2, enter slow start

29 Example Transport Layer 1-29 RTTcwndssthreshEvent 1Initial: 1 MSS = 1 KBInitial: 64KB 2264 34 48 51664Timeout or 3 dup ACKs 618 728 848 988 1098 11108Timeout or 3 ACKs 1215 1325  Assume 1 MSS = 1 KB

30 TCP Reno 1-30  Slow start still incorporates exponential increase  If a timeout event occurs in any state the reaction is the same  cwnd = 1, ssthresh = cwnd/2, increase exponentially until cwnd ≥ ssthresh, then enter congestion avoidance  The main difference is in the reaction to 3 duplicate ACKs  Recall: 3 duplicate ACKs means that one ACK is missing  Here, TCP Reno will enter fast recovery state: keep increasing exponentially while waiting for missing ACK  If the missing ACK did not arrive then a timeout will occur  cwnd = 1, ssthresh = cwnd/2, go to slow start (increase exponentially)  If the missing ACK arrives  cwnd = ssthresh, go to congestion avoidance directly (increase linearly)

31 Example 1-31


Download ppt "CSEN 404 Transport Layer II Amr El Mougy Lamia AlBadrawy."

Similar presentations


Ads by Google