2.5 Reliable Transmission

Slides:



Advertisements
Similar presentations
TCP Sliding Windows, Flow Control, and Congestion Control Lecture material taken from Computer Networks A Systems Approach, Fourth Ed.,Peterson and Davie,
Advertisements

Ethernet. Most successful local area networking technology of last 20 years. Developed in the mid-1970s by researchers at the Xerox Palo Alto Research.
Advanced Computer Networks : TCP Sliding Windows1 TCP Sliding Windows, Flow Control, and Congestion Control Lecture material taken from “Computer Networks.
Chapter 2: Direct Link Networks (continued) Slide Set 5.
The ALOHA Protocol “Free for all”: whenever station has a frame to send, it does so. –Station listens for maximum RTT for an ACK. –If no ACK after a specified.
Ethernet – CSMA/CD Review
Spring 2002CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
1 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
ACN: TCP Sliding Windows1 TCP Sliding Windows, with Flow Control, and Congestion Control Based on Peterson and Davie Textbook.
Advanced Computer Networks : TCP Sliding Windows1 TCP Sliding Windows, Flow Control, and Congestion Control Lecture material taken from “Computer Networks.
Spring 2002CS 4611 Shared Access Networks Outline Bus (Ethernet) Token ring (FDDI) Wireless (802.11)
Spring 2004 EE4272 Direct Link Networks (I) Hardware Building Blocks (nodes & links) 5 Issues before Exchanging Packets  Encoding  Framing  Error Detection.
EE 4272Spring, 2003 Chapter 14 LAN Systems Ethernet (CSMA/CD)  ALOHA  Slotted ALOHA  CSMA  CSMA/CD Token Ring /FDDI Fiber Channel  Fiber Channel Protocol.
5-1 Data Link Layer r Today, we will study the data link layer… r This is the last layer in the network protocol stack we will study in this class…
Spring 2003CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Networking. Protocol Stack Generally speaking, sending an message is equivalent to copying a file from sender to receiver.
18-Aug-154/598N: Computer Networks Overview Direct link networks –Error detection - Section 2.4 –Reliable transmission - Section 2.5.
Spring 2006CS 3321 Chapter 2 Tidbits Outline A little hardware Ethernet Realistic data transfer rates.
Enhanced CSMA Additional improvement  Use CSMA access  Listen while transmitting  Stop immediately if collision sensed  Called collision detection.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 17.
Principles of Reliable Data Transfer. Reliable Delivery Making sure that the packets sent by the sender are correctly and reliably received by the receiver.
1 Computer Communication & Networks Lecture 13 Datalink Layer: Local Area Network Waleed Ejaz
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 11 Data Link Control Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
ECE 4450:427/527 - Computer Networks Spring 2015 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 5.3: Reliable Transmission Dr. Nghi.
Data Link Layer We have now discussed the prevalent shared channel technologies  Ethernet/IEEE  Wireless LANs (802.11) We have now covered chapters.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 16.
14-Oct-15Computer Networks1 Reliable Transmission.
LANs : Aloha/CSMA , summary
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
Transport Layer: Sliding Window Reliability
EE 122: Lecture 6 Ion Stoica September 13, 2001 (* this talk is based in part on the on-line slides of J. Kurose & K. Rose)
1 Ethernet CSE 3213 Fall February Introduction Rapid changes in technology designs Broader use of LANs New schemes for high-speed LANs High-speed.
1 Ethernet History –developed by Xerox PARC in mid-1970s –roots in Aloha packet-radio network –standardized by Xerox, DEC, and Intel in 1978 –similar to.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Principles of reliable data transfer 0.
1 Direct Link Networks: Reliable Transmission Sections 2.5.
CSE331: Introduction to Networks and Security Lecture 4 Fall 2002.
Computer Networking Lecture 16 – Reliable Transport.
Data Link Layer.
1 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 Computer Networks: A Systems Approach, 5e Larry L. Peterson and Bruce S. Davie Chapter 2 Getting Connected Copyright © 2010, Elsevier Inc. All rights.
CS380 Int. to Comp. Networks Data Link Networks - Part II1 Reliable Transmission How to fix corrupted frames. –Error correcting codes too expensive –Should.
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
Reliable Transmission
Data Link Layer Flow Control.
Part III Datalink Layer 10.
The University of Adelaide, School of Computer Science
Getting Connected (Chapter 2 Part 3)
B. R. Chandavarkar CSE Dept., NITK Surathkal
Data link layer (LLC).
Introduction of Transport Protocols
ECE 4450:427/527 - Computer Networks Spring 2017
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
Data Link Layer: Data Link Control
Getting Connected (Chapter 2 Part 3)
Reliable transmission
Point-to-Point Links Outline Encoding Framing Error Detection
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
Outline A little hardware Ethernet Realistic data transfer rates
TCP Sliding Windows, Flow Control, and Congestion Control
Protocol layering and data
Advanced Computer Networks
Getting Connected (Chapter 2 Part 3)
The Transport Layer Reliability
Protocol layering and data
Transport Layer Outline Intro to transport UDP
Ethernet 16EC351 Computer networks unit II Mr.M.Jagadesh,AP/ECE.
TCP Sliding Windows, Flow Control, and Congestion Control
LAN Addresses and ARP IP address: drives the packet to destination network LAN (or MAC or Physical) address: drives the packet to the destination node’s.
Error detection: Outline
TCP Sliding Windows, Flow Control, and Congestion Control
Presentation transcript:

2.5 Reliable Transmission Acknowledgements & Timeouts Stop-and-Wait Sliding Window

This is usually accomplished using a combination of two mechanisms A link level protocol that wants to deliver frames reliably must somehow recover from those discarded (lost) frames This is usually accomplished using a combination of two mechanisms Acknowledgment (ACK) an acknowledgment (ACK) is a small control frame that a protocol sends back to the sender to indicate the original frame was successfully delivered Retransmit if the sender does not receive an acknowledgment after a reasonable amount of time, then it retransmits the original frame

Timeout this action of waiting a reasonable amount of time is called a timeout Automatic repeat request (ARQ) the general strategy of using acknowledgments and timeouts to implement reliable delivery is sometimes called automatic repeat request (ARQ)

Acknowledgements & Timeouts The simplest ARQ scheme is the stop-and-wait algorithm Stop-and-wait algorithm after transmitting one frame, the sender waits for an acknowledgement (ACK) before transmitting the next frame if the ACK does not arrive after a certain period of time, the sender times out and retransmits the original frame

Timeline showing four different scenarios for the stop-and-wait algorithm the sending side is represented on the left the receiving side is depicted on the right time flows from top to bottom figure (a) to (d) (a) shows the ACK is received before the timer expires (b) and (c) show the original frame and the ACK, respectively, are lost (d) shows the timeout fires too soon

The “lost” means that the frame was corrupted while in transit, that this corruption was detected by an error code on the receiver, and that the frame was subsequently discarded

Suppose the sender sends a frame and the receiver acknowledges it, but the acknowledgment is either lost or delayed in arriving in both cases, the, sender times out and retransmits the original frame, but the receiver will think that it is the next frame, since it correctly received and acknowledged the first frame this has the potential to cause duplicate of a frame to be delivered to address this prob1em, the header for a stop-and-wait protocol usually includes a 1-bit sequence number – i.e., the sequence number can take on the values 0 and 1 - and the sequence numbers used for each frame alternate

Stop-and-wait algorithm with 1-bit sequence number the header for a stop-and-wait protocol includes a 1-bit sequence number (0 or 1) when the sender retransmits frame 0, the receiver can determine that it is seeing a second copy of frame 0 rather than the first copy of frame 1 and therefore can ignore it

shortcoming it allows the sender to have only one outstanding (un-ACKed) frame on the link at a time, and this may far below the link’s capacity example a 1.5Mbps link with a 45-ms round-trip time delay × bandwidth product 45ms (RTT) × 1.5Mbps (link) = 67.5Kb (8KB)

since the sender can send only one frame per RTT, and assuming a frame size of 1 KB, this implies a maximum sending rate bits per frame ÷ time per frame = (1024 × 8) ÷ 0.045 = 182 Kbps or about 1/8th (= (182 ÷ 1024) ÷ 1.5) link’s capacity

Timeline for stop-and-wait with 1-bit sequence number Sender Receiver Frame 0 Frame 1 ACK 0 ACK 1 Timeline for stop-and-wait with 1-bit sequence number

Keeping the pipe full to use the link fully, we’d like the sender to be able to transmit up to eight frames before having to wait for an acknowledgment (consider the 1/8th link’s utilization in the example) the significance of the bandwidth × delay product is that it represents the amount of data that could be in transit we would like to be able to send this much data without waiting for the first acknowledgment (ie., keeping the pipe full)

Sliding Window Allow multiple outstanding (un-ACKed) frames Upper bound on un-ACKed frames, called window

SW: Sender Assign a sequence number (SeqNum) to each frame Maintain three state variables send window size (SWS) the upper bound on the number of outstanding (unacknowledged) frames that the sender can transmit last acknowledgment received (LAR) the sequence number of the last acknowledgment received last frame sent (LFS) the sequence number of the last frame sent

Maintain invariant: LFS - LAR≦SWS When an ACK arrives, the sender moves LAR to the right, thereby allowing the sender to transmit another frame The sender associates a timer with each frame it transmits, and it retransmits the frame should the timer expire before an ACK is received The sender has to be willing to buffer up to SWS frames since it must be prepared to retransmit them until they are acknowledged < SWS LAR LFS ■ ■ ■ ─

SW: Receiver Maintain three state variables receive window size (RWS) the upper bound on the number of out-of-order frames that the receiver is willing to accept largest frame acceptable (LAF) the sequence number of the largest-acceptable frame last frame received (LFR) the sequence number of the last frame received

Maintain invariant: LAF - LFR ≦ RWS Frame SeqNum arrives if LFR < SeqNum ≦ LAF then accept (within the receiver’s window) if SeqNum ≦ LFR or SeqNum > LAF then discarded (outside the receiver’s window) RWS LFR LAF ■ ■ ■ < ─

Let SeqNumToAck denote the largest sequence number not yet acknowledged, such that all frames with sequence numbers less than or equal to SeqNumToAck have been received the receiver acknowledges the receipt of SeqNumToAck, even if higher-numbered packets have been received this acknowledgement is said to be cumulative(漸增) sets LFR = SeqNumToAck & adjusts LAF = LFR + RWS

Example suppose LFR = 5 (i.e., the last ACK the receiver sent was for sequence number 5), and RWS = 4 this implies that LAF = 9 should frames 7 and 8 arrive, they will be buffered because they are within the receiver’s window no ACK needs to be sent since frame 6 is yet to arrive frames7 and 8 are said to have arrived out of order

should frame 6 then arrive perhaps it was lost and had to be retransmitted, or perhaps it was simply delayed - the receiver acknowledges frame 8, bumps LFR to 8, and sets LAF to 12 if frame 6 was in fact lost then a timeout will have occurred at the sender, causing it to retransmit frame 6

When a timeout occurs, the amount of data in transit decreases since the sender is unable to advance its window until frame 6 is acknowledged this means that when packet losses occur, this scheme is no longer keeping the pipe full Early detection of packet losses giving more information to the sender makes it potentially easier for the sender to keep the pipe full, but adds complexity to the implementation

sol-1 the receiver could send a negative acknowledgment (NAK) for frame 6 as soon as frame 7 arrived (adds additional complexity to the receiver) sol-2 send additional acknowledgments of frame 5 when frames 7 and 8 arrived, e.g., a sender can use duplicate ACKs as a clue that a frame was lost sol-3 selective acknowledgment:the receiver acknowledges exactly those frames it has received, rather than just the highest-numbered frame received in order, e.g., the receiver could acknowledge the receipt of frames 7 and 8

Send window size selected according to how many frames we want to have outstanding on the link at a given time SWS is easy to compute for a given delay × bandwidth product

Receive window size the receiver can set RWS to whatever it wants RWS = 1 the receiver will not buffer any frames that arrive out of order RWS = SWS the receiver can buffer any of the frames the sender transmits RWS > SWS makes no sense, it’s impossible for more than SWS frames to arrive out of order

Sequence Number Space SeqNum field is finite; sequence numbers wrap around (折回) Sequence number space must be larger then number of outstanding frames, e.g. stop-and-wait (1-bit): allows 1 outstanding frame at a time and has two distinct sequence numbers (0 &1) a 3-bit field: allows 7 outstanding frame at a time and has 8 distinct sequence numbers (0..7)

Is SWS ≦ MaxSeqNum-1 (MaxSeqNum is the number of available sequence numbers) correct? if RWS = 1, then MaxSeqNum≧SWS+1 is correct [the receiver will not buffer any frames that arrive out of order] if RWS=SWS, then MaxSeqNum≧SWS+1 is incorrect example (MaxSeqNum=8 & SWS=7) assumption 3-bit SeqNum field (sequence numbers 0..7) SWS=RWS=7 Scenario (we want to avoid this) the sender transmits frames 0..6, successfully arrive, but ACK lost the receiver is now expecting frames 7, 0..5 (sequence numbers wrap around) the sender times out and sends 0..6

The sending window size can be no more than half as big as the number of available sequence numbers when RWS=SWS SWS <(MaxSeqNum+1)/2 General rule for arbitrary values of RWS and SWS MaxSeqNum≧SWS+RWS Implementation of Sliding Window (pp. 109-114)

Frame Order and Flow Control Sliding window protocol can be used to serve three different roles reliably deliver frames across an unreliable link (the core function of the algorithm) preserve the order in which frames are transmitted this is easy to do at the receiver - since each frame has a sequence number, the receiver just makes sure that it does not pass a frame up to the next-higher-level protocol until it has already passed up all frames with a smaller sequence number i.e., the receiver buffers out-of-order frames

support flow control a feedback mechanism by which the receiver is able to throttle the sender keep the sender from overrunning the receiver, that is, from transmitting more data than the receiver is able to process this is usually accomplished by augmenting the sliding window protocol so that the receiver not only acknowledges frames it has received, but also informs the sender of how many frames it has room (free buffer space) to receive Throttle:節流閥; 節流圈; 油門; 風門

Concurrent Logical Channels multiplex several logical channels onto a single point-to-point link and to run the stop-and-wait algorithm on each of these logical channels maintain 3 bits of state for each channel channel busy (yes/no) current sequence number out next sequence number in example: ARPANET

2.6 Ethernet (802.3) History developed by Xerox Palo Alto Research Center (PARC) in mid-1970s roots in Aloha packet-radio network 10 Mbps Ethernet is standardized by Xerox, DEC, and Intel in 1978 Ethernet is standardized as IEEE 802.3

Ethernet a family of frame-based computer networking technologies for local area networks (LANs) originally used a shared coaxial cable winding around a building or campus to every attached machine a working example of the carrier sense, multiple access with collision detection (CSMA/CD) governed the way the computers shared the channel

carrier sense means that all the nodes can distinguish between an idle and a busy link collision detect means that a node listens as it transmits and can therefore detect when a frame it is transmitting has interfered (collide) with a frame transmitted by another node

a multiple-access network meaning that a set of nodes send and receive frames over a shared link Ethernet can be thought of as being like a bus that has multiple stations plugged into it data rates Ethernet:10 Mbps Fast Ethernet:100 Mbps Gigabit Ethernet:1,000 Mbps

Physical Properties Ethernet segment Host implemented on a coaxial cable of up to 500m (impedance of 50-ohm) this cable is similar to the type used for cable TV, except cable TV’s 75 ohms Host connects to the Ethernet segment by tapping into it; taps must be 2.5m apart Impedance:【電】阻抗 Tap: 接通(總電源,總水源等),(電流)分接頭

Transceiver a small device directly attached to the tap detects when the line is idle and drives the signal when the host is transmitting receives incoming signals connects to an Ethernet adaptor, which is plugged into the host Adaptor all the logic that makes up the Ethernet protocol is implemented in the adaptor

Ethernet transceiver and adaptor

Repeater multiple Ethernet segments can be joined together by repeaters a device that forwards digital signals, much like an amplifier forwards analog signals no more than four repeaters may be positioned between any pair of hosts an Ethernet has a total reach of only 2,500m an Ethernet is limited to supporting a maximum of 1,024 hosts

Ethernet repeater

Example of Ethernet repeater use just two repeaters between any pair of hosts a segment running down the spine of a building with a segment on each floor

Any signal placed on the Ethernet is broadcast over the entire network propagated in both directions repeater forward the signal on all ongoing segments

Encoding Ethernet uses the Manchester encoding scheme terminator attached to the end of each segment absorb the signal and keep it from bouncing back and interfering with trailing signals Encoding Ethernet uses the Manchester encoding scheme

Coax cable evolution 50-ohm coax cable thick-net 10Base5 10 means 10Mbps Base means baseband system 5 means that a given segment can be no longer than 500m

thin-net 10Base2 10Mbps 2 means that a given segment can be no longer than 200m 10BaseT T means twisted pair (Category 5 twisted pair) limited to under 100m in length

100BaseT 100Mbps Category 5 twisted pair limited to under 100m in length 1000BaseT 1000Mbps

Access Protocol Ethernet is a bit oriented framing protocol Media access control (MAC) control access to the shared Ethernet link implemented in hardware on the network adaptor Ethernet is a bit oriented framing protocol Frame format Preamble (64 bits) allows the receiver to synchronize with the signal a sequence of alternating 0s and 1s

Dest addr & Src addr (48 + 48 bits) both the source and destination hosts are identified with a 48-b address Type (16 bits) demultiplexing key it identifies to which of possibly many higher-level protocols this frame should be delivered Body 46 (used to detect a collision) to 1,500 bytes of data

CRC (32 bits) each frame includes a 32-bit CRC from the host perspective, an Ethernet frame a 14-byte header two 6-byte addresses a 2-byte type field the sending adaptor attaches the preamble, CRC, and postamble before transmitting, and the receiving adaptor removes them

Ethernet a bit-oriented framing protocol Ethernet frame format

Addresses The address belongs to the adaptor, not the host, it is actually burned into ROM Addresses a sequence of six numbers (48 bits, hexadecimal digits) separated by colons, example: 8:0:2b:e4:b1:2 00001000 00000000 00101011 11100100 10110001 00000010 unique: 48-bit unicast address assigned to each adapter broadcast: all 1s multicast: first bit is 1

Each frame transmitted on an Ethernet is received by every adaptor connected to that Ethernet each adaptor recognizes those frames addressed to its address and passes only those frames on to the host an adaptor can also be programmed to run in promiscuous mode, in which case it delivers all received frames to the host, but this is not the normal mode Promiscuous:漫無目的的

Summary an Ethernet adaptor receives all frames and accepts frames addressed to its own address frames addressed to the broadcast address frames addressed to a multicast address, if it has been instructed to listen to that address all frames, if it has been placed in promiscuous mode an Ethernet adaptor passes to the host only the frames that it accepts

Transmit Algorithm When the adaptor has a frame to send if line is idle send immediately (no negotiation with the other adaptors) upper bound message size of 1500 bytes (means that the adaptor can occupy the line for only a fixed length of time) must wait 9.6μs after the end of one frame before beginning to transmit the next frame if line is busy wait until idle and transmit immediately

Ethernet is said to be a 1-persistent protocol because an adaptor with a frame to send transmits with probability 1 whenever a busy line goes idle In general, a p-persistent algorithm transmits with probability 0 ≦ p ≦1 after a line becomes idle, and defers with probability q = 1- p (there might be multiple adaptors waiting for the busy line to become idle, and we don’t want all of them to begin transmitting at the same time)

Because there is no centralized control it is possible for two (or more) adaptors to begin transmitting at the same time, either because both found the line to be idle or because both had been waiting for a busy line to become idle. When this happens, the two (or more) frames are said to collide on the network

If an adaptor detects that its frame is colliding with another transmits a 32-bit jamming sequence and then stop transmitting frame a transmitter will minimally send “64-bit preamble plus 32-bit jamming sequence = 96 bits (runt frame)” in the case of collision The worst case scenario (the two hosts are at opposite ends of the Ethernet) transmitter needs to send 512 bits to make sure that the frame it just sent did not collide with another frame 512 bits is the minimum frame size:64 bytes (14 bytes header + 46 bytes of data + 4 bytes of CRC)

(a) A sends a frame at time t scenario (a) A sends a frame at time t (b) the first bit of A’s frame arrives at B at time t+d (d is link latency) (c) suppose an instant before host A’s frame arrives, B still sees an idle line and begins transmitting at time t+d and collides with A’s frame (this collision is detected by host B) (d) B’s runt (32-bit jamming sequence) frame arrives at A at time t+2d A will not know that the collision occurred until B’s runt reaches it A must transmit for 2×d to be sure that it detects all possible collisions Runt: 小家畜;小植物

Worst-case scenario: (a) A sends a frame at time t; (b) A’s frame arrives at B at time t + d; (c) B begins transmitting at time t + d and collides with A’s frame; (d) B’s runt (32-bit) frame arrives at A at time t + 2d

round-trip delay and try again each time it tries to transmit but fails, the adaptor doubles the amount of time it waits before trying again (exponential backoff) 1st collision delay : 0 or 51.2μs (round-trip delay, which on a 10-Mbps Ethernet corresponds to 512 bits), selected at random 2nd collision delay: 0, 51.2, 102.4, or 153.6μs, selected at random nth collision delay: k x 51.2μs, for randomly selected k=0..2n – 1 (min {n, 10}) adaptor typically retry up to 16 times