SlideShare a Scribd company logo
5
Most read
6
Most read
10
Most read
CS 640 1
Outline
RTT estimation using EWMA
Stop and Wait
Sliding Window Algorithms
Transport Layer: Sliding
Window Reliability
CS 640 2
Transport layer functions
• Transport protocol defines the pattern/sequence for end hosts
sending packets
• Transport has to deal with a number of things
– Multiplexing/demultiplexing – ports and message queues
– Error detection within packets - checksums
– Reliable, in order delivery of packets - Today
– Flow control – Today
– Connection management - TBD
– Congestion control – TBD
• We’re moving toward understanding TCP
CS 640 3
Methods of Reliability
• Packets can be lost and/or corrupted during transmission
– Bit level errors due to noise
– Loss due to congestion
• Use checksums to detect bit level errors
– Internet Checksum is optionally used to detect errors in UDP
• Uses 16 bits to encode one’s complement sum of data + headers
– When bit level errors are detected, packets are dropped
• Build reliability into the transmission protocol
– Using acknowledgements and timeouts to signal lost or corrupt
frame
CS 640 4
Acknowledgements & Timeouts
• An acknowledgement (ACK) is a packet sent by one host
in response to a packet it has received
– Making a packet an ACK is simply a matter of changing a field in
the transport header
– Data can be piggybacked in ACKs
• A timeout is a signal that an ACK to a packet that was sent
has not yet been received within a specified timeframe
– A timeout triggers a retransmission of the original packet from the
sender
– How are timers set?
CS 640 5
Acknowledgements & Timeouts
Sender Receiver
Frame
ACK
Timeout
Time
Sender Receiver
Frame
ACK
Timeout
Frame
ACK
Timeout
Sender Receiver
Frame
ACK
Timeout Frame
ACK
Timeout
Sender Receiver
Frame
Timeout
Frame
ACK
Timeout
(a) (c)
(b) (d)
CS 640 6
Propagation Delay
• Propagation delay is defined as the delay between
transmission and receipt of packets between hosts
• Propagation delay can be used to estimate timeout
period
• How can propagation delay be measured?
• What else must be considered in the measurement?
CS 640 7
Exponentially weighted moving
average RTT estimation
• EWMA was original algorithm for TCP
• Measure SampleRTT for each packet/ACK pair
• Compute weighted average of RTT
– EstRTT = a x EstimatedRTT + b x SampleRTT
– where a + b = 1
 a between 0.8 and 0.9
 b between 0.1 and 0.2
• Set timeout based on EstRTT
– TimeOut = 2 x EstRTT
CS 640 8
Stop-and-Wait Process
• Sender doesn’t send next packet until he’s sure receiver has last packet
• The packet/Ack sequence enables reliability
• Sequence numbers help avoid problem of duplicate packets
• Problem: keeping the pipe full
• Example
– 1.5Mbps link x 45ms RTT = 67.5Kb (8KB)
– 1KB frames imples 1/8th link utilization
Sender Receiver
CS 640 9
Solution: Pipelining via Sliding Window
• Allow multiple outstanding (un-ACKed) frames
• Upper bound on un-ACKed frames, called window
Sender Receiver
Time
…
…
CS 640 10
Buffering on Sender and Receiver
• Sender needs to buffer data so that if data is lost, it can be resent
• Receiver needs to buffer data so that if data is received out of
order, it can be held until all packets are received
– Flow control
• How can we prevent sender overflowing receiver’s buffer?
– Receiver tells sender its buffer size during connection setup
• How can we insure reliability in pipelined transmissions?
– Go-Back-N
• Send all N unACKed packets when a loss is signaled
• Inefficient
– Selective repeat
• Only send specifically unACKed packets
• A bit trickier to implement
CS 640 11
Sliding Window: Sender
• Assign sequence number to each frame (SeqNum)
• Maintain three state variables:
– send window size (SWS)
– last acknowledgment received (LAR)
– last frame sent (LFS)
• Maintain invariant: LFS - LAR <= SWS
• Advance LAR when ACK arrives
• Buffer up to SWS frames
SWS
LAR LFS
… …
CS 640 12
Sliding Window: Receiver
• Maintain three state variables
– receive window size (RWS)
– largest frame acceptable (LFA)
– last frame received (LFR)
• Maintain invariant: LFA - LFR <= RWS
• Frame SeqNum arrives:
– if LFR < SeqNum < = LFA accept
– if SeqNum < = LFR or SeqNum > LFA discarded
• Send cumulative ACKs – send ACK for largest frame such that all
frames less than this have been received
 RWS
LFR LFA
… …
CS 640 13
Sequence Number Space
• SeqNum field is finite; sequence numbers wrap around
• Sequence number space must be larger then number of
outstanding frames
• SWS <= MaxSeqNum-1 is not sufficient
– suppose 3-bit SeqNum field (0..7)
– SWS=RWS=7
– sender transmit frames 0..6
– arrive successfully, but ACKs lost
– sender retransmits 0..6
– receiver expecting 7, 0..5, but receives the original incarnation of 0..5
• SWS < (MaxSeqNum+1)/2 is correct rule
• Intuitively, SeqNum “slides” between two halves of sequence
number space
CS 640 14
Another Pipelining Possibility:
Concurrent Logical Channels
• Multiplex 8 logical channels over a single link
• Run stop-and-wait on each logical channel
• Maintain three state bits per channel
– channel busy
– current sequence number out
– next sequence number in
• Header: 3-bit channel num, 1-bit sequence num
– 4-bits total
– same as sliding window protocol
• Separates reliability from order
CS 640 15
Stop & wait sequence numbers
Sender Receiver
Timeout
Timeout
Sender Receiver
Timeout
Timeout
(c) (d)
Sender Receiver
(e)
• Simple sequence numbers enable the client to
discard duplicate copies of the same frame
• Stop & wait allows one outstanding frame, requires
two distinct sequence numbers
CS 640 16
Sliding Window Example
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0
1
2
Sender Receiver
A3
3
4
5
6
A4
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
CS 640 17
Sliding Window Summary
• Sliding window is best known algorithm in networking
• First role is to enable reliable delivery of packets
– Timeouts and acknowledgements
• Second role is to enable in order delivery of packets
– Receiver doesn’t pass data up to app until it has packets in
order
• Third role is to enable flow control
– Prevents server from overflowing receiver’s buffer

More Related Content

PPTX
6610-l14.pptx
PPTX
Network protocols and vulnerabilities
PPT
5 sharing-app
PPTX
PPTX
Network Transports layers and Computer Networks
PDF
Transport Control Protocol
PPT
CN_unit2.ppt Data Link Layer characteristics, categories
PPTX
3.TRANSPORT LAYER Computer Network .pptx
6610-l14.pptx
Network protocols and vulnerabilities
5 sharing-app
Network Transports layers and Computer Networks
Transport Control Protocol
CN_unit2.ppt Data Link Layer characteristics, categories
3.TRANSPORT LAYER Computer Network .pptx

Similar to sliding window protocol for datalink layer.ppt (20)

PPT
OSI Model - transport Layer protocols
PPT
05Transport protocols and internet design.ppt
PPTX
New framing-protocols
PDF
8. TDM Mux_Demux.pdf
PPTX
Transport layer
PPTX
Lecture 36-43_DATA_COMMUNICATION_PPT.pptx
PPTX
Datalink control(framing,protocols)
PDF
materi uas jarkom tahun ajaraan 2022.pdf
PDF
14-Error Detection Techniques-22-01-2025.pdf
PPT
Transport ppt for students examination.ppt
PPT
05Transport.ppt
PPT
Lect9 (1)
PPT
Lect9
PDF
advances in computer networks Notes M.tech
PPTX
Data link layer elementry protocols
PPTX
Part5-tcp-improvements.pptx
PDF
Computer Networks Module 2.pdf
PPTX
Part 9 : Congestion control and IPv6
PPT
PPTX
Computer networks module 2 data link layer
OSI Model - transport Layer protocols
05Transport protocols and internet design.ppt
New framing-protocols
8. TDM Mux_Demux.pdf
Transport layer
Lecture 36-43_DATA_COMMUNICATION_PPT.pptx
Datalink control(framing,protocols)
materi uas jarkom tahun ajaraan 2022.pdf
14-Error Detection Techniques-22-01-2025.pdf
Transport ppt for students examination.ppt
05Transport.ppt
Lect9 (1)
Lect9
advances in computer networks Notes M.tech
Data link layer elementry protocols
Part5-tcp-improvements.pptx
Computer Networks Module 2.pdf
Part 9 : Congestion control and IPv6
Computer networks module 2 data link layer
Ad

More from ManimegalaM3 (14)

PPT
Overview-Of-IT-System-20211013104714.ppt
PPT
12-adhoc_unit 4 _mobile computing_sem5.ppt
PPTX
FRONTEND TECHNOLOGIES _UNIT 1 PRESENTATION.pptx
PPTX
SPEECH EMOTION RECOGNITION SYSTEM (1).pptx
PPTX
mobilecomputing-unit1material-230123065357-80aaef7f (1) (1).pptx
PPTX
mobilecomputing-18101915462011111 (1).pptx
PPTX
Computer_Organization_and_Architecture.pptx
PPT
the-sparc-architecture computer organisation.ppt
PDF
UNit-4 Transport Layer and its protocols.pdf
PPT
OSI transmission model_7layers for communication .ppt
PPTX
network topology _computer networks.pptx
PPT
Introduction to computer network and functions.ppt
PPTX
Computer_Organization and architecture _unit 1.pptx
PPT
lec12-pipelining.ppt
Overview-Of-IT-System-20211013104714.ppt
12-adhoc_unit 4 _mobile computing_sem5.ppt
FRONTEND TECHNOLOGIES _UNIT 1 PRESENTATION.pptx
SPEECH EMOTION RECOGNITION SYSTEM (1).pptx
mobilecomputing-unit1material-230123065357-80aaef7f (1) (1).pptx
mobilecomputing-18101915462011111 (1).pptx
Computer_Organization_and_Architecture.pptx
the-sparc-architecture computer organisation.ppt
UNit-4 Transport Layer and its protocols.pdf
OSI transmission model_7layers for communication .ppt
network topology _computer networks.pptx
Introduction to computer network and functions.ppt
Computer_Organization and architecture _unit 1.pptx
lec12-pipelining.ppt
Ad

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Lesson notes of climatology university.
PPTX
Institutional Correction lecture only . . .
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Types and Its function , kingdom of life
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Presentation on HIE in infants and its manifestations
Supply Chain Operations Speaking Notes -ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Microbial disease of the cardiovascular and lymphatic systems
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Final Presentation General Medicine 03-08-2024.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
O5-L3 Freight Transport Ops (International) V1.pdf
Lesson notes of climatology university.
Institutional Correction lecture only . . .
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial diseases, their pathogenesis and prophylaxis
Cell Types and Its function , kingdom of life
human mycosis Human fungal infections are called human mycosis..pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Pharma ospi slides which help in ospi learning
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Presentation on HIE in infants and its manifestations

sliding window protocol for datalink layer.ppt

  • 1. CS 640 1 Outline RTT estimation using EWMA Stop and Wait Sliding Window Algorithms Transport Layer: Sliding Window Reliability
  • 2. CS 640 2 Transport layer functions • Transport protocol defines the pattern/sequence for end hosts sending packets • Transport has to deal with a number of things – Multiplexing/demultiplexing – ports and message queues – Error detection within packets - checksums – Reliable, in order delivery of packets - Today – Flow control – Today – Connection management - TBD – Congestion control – TBD • We’re moving toward understanding TCP
  • 3. CS 640 3 Methods of Reliability • Packets can be lost and/or corrupted during transmission – Bit level errors due to noise – Loss due to congestion • Use checksums to detect bit level errors – Internet Checksum is optionally used to detect errors in UDP • Uses 16 bits to encode one’s complement sum of data + headers – When bit level errors are detected, packets are dropped • Build reliability into the transmission protocol – Using acknowledgements and timeouts to signal lost or corrupt frame
  • 4. CS 640 4 Acknowledgements & Timeouts • An acknowledgement (ACK) is a packet sent by one host in response to a packet it has received – Making a packet an ACK is simply a matter of changing a field in the transport header – Data can be piggybacked in ACKs • A timeout is a signal that an ACK to a packet that was sent has not yet been received within a specified timeframe – A timeout triggers a retransmission of the original packet from the sender – How are timers set?
  • 5. CS 640 5 Acknowledgements & Timeouts Sender Receiver Frame ACK Timeout Time Sender Receiver Frame ACK Timeout Frame ACK Timeout Sender Receiver Frame ACK Timeout Frame ACK Timeout Sender Receiver Frame Timeout Frame ACK Timeout (a) (c) (b) (d)
  • 6. CS 640 6 Propagation Delay • Propagation delay is defined as the delay between transmission and receipt of packets between hosts • Propagation delay can be used to estimate timeout period • How can propagation delay be measured? • What else must be considered in the measurement?
  • 7. CS 640 7 Exponentially weighted moving average RTT estimation • EWMA was original algorithm for TCP • Measure SampleRTT for each packet/ACK pair • Compute weighted average of RTT – EstRTT = a x EstimatedRTT + b x SampleRTT – where a + b = 1  a between 0.8 and 0.9  b between 0.1 and 0.2 • Set timeout based on EstRTT – TimeOut = 2 x EstRTT
  • 8. CS 640 8 Stop-and-Wait Process • Sender doesn’t send next packet until he’s sure receiver has last packet • The packet/Ack sequence enables reliability • Sequence numbers help avoid problem of duplicate packets • Problem: keeping the pipe full • Example – 1.5Mbps link x 45ms RTT = 67.5Kb (8KB) – 1KB frames imples 1/8th link utilization Sender Receiver
  • 9. CS 640 9 Solution: Pipelining via Sliding Window • Allow multiple outstanding (un-ACKed) frames • Upper bound on un-ACKed frames, called window Sender Receiver Time … …
  • 10. CS 640 10 Buffering on Sender and Receiver • Sender needs to buffer data so that if data is lost, it can be resent • Receiver needs to buffer data so that if data is received out of order, it can be held until all packets are received – Flow control • How can we prevent sender overflowing receiver’s buffer? – Receiver tells sender its buffer size during connection setup • How can we insure reliability in pipelined transmissions? – Go-Back-N • Send all N unACKed packets when a loss is signaled • Inefficient – Selective repeat • Only send specifically unACKed packets • A bit trickier to implement
  • 11. CS 640 11 Sliding Window: Sender • Assign sequence number to each frame (SeqNum) • Maintain three state variables: – send window size (SWS) – last acknowledgment received (LAR) – last frame sent (LFS) • Maintain invariant: LFS - LAR <= SWS • Advance LAR when ACK arrives • Buffer up to SWS frames SWS LAR LFS … …
  • 12. CS 640 12 Sliding Window: Receiver • Maintain three state variables – receive window size (RWS) – largest frame acceptable (LFA) – last frame received (LFR) • Maintain invariant: LFA - LFR <= RWS • Frame SeqNum arrives: – if LFR < SeqNum < = LFA accept – if SeqNum < = LFR or SeqNum > LFA discarded • Send cumulative ACKs – send ACK for largest frame such that all frames less than this have been received  RWS LFR LFA … …
  • 13. CS 640 13 Sequence Number Space • SeqNum field is finite; sequence numbers wrap around • Sequence number space must be larger then number of outstanding frames • SWS <= MaxSeqNum-1 is not sufficient – suppose 3-bit SeqNum field (0..7) – SWS=RWS=7 – sender transmit frames 0..6 – arrive successfully, but ACKs lost – sender retransmits 0..6 – receiver expecting 7, 0..5, but receives the original incarnation of 0..5 • SWS < (MaxSeqNum+1)/2 is correct rule • Intuitively, SeqNum “slides” between two halves of sequence number space
  • 14. CS 640 14 Another Pipelining Possibility: Concurrent Logical Channels • Multiplex 8 logical channels over a single link • Run stop-and-wait on each logical channel • Maintain three state bits per channel – channel busy – current sequence number out – next sequence number in • Header: 3-bit channel num, 1-bit sequence num – 4-bits total – same as sliding window protocol • Separates reliability from order
  • 15. CS 640 15 Stop & wait sequence numbers Sender Receiver Timeout Timeout Sender Receiver Timeout Timeout (c) (d) Sender Receiver (e) • Simple sequence numbers enable the client to discard duplicate copies of the same frame • Stop & wait allows one outstanding frame, requires two distinct sequence numbers
  • 16. CS 640 16 Sliding Window Example 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 Sender Receiver A3 3 4 5 6 A4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  • 17. CS 640 17 Sliding Window Summary • Sliding window is best known algorithm in networking • First role is to enable reliable delivery of packets – Timeouts and acknowledgements • Second role is to enable in order delivery of packets – Receiver doesn’t pass data up to app until it has packets in order • Third role is to enable flow control – Prevents server from overflowing receiver’s buffer