260 likes | 281 Views
Learn about error-correction codes, lost frames recovery, ARQ algorithms, and sliding window protocol in Data Link Networks. Understand Stop-and-Wait and Sliding Window strategies for reliable data transmission.
E N D
Reliable Transmission • How to fix corrupted frames. • Error correcting codes too expensive • Should discard frames (retransmission) • Recover from Corrupt Frames should be done in the Link Level Data Link Networks - Part II
Reliable Transmission • Recovery is accomplished with two mechanisms • Acknowledgements (ACK) • Small control frame (a frame with header only but no data) sent back indicating successful frame delivery • Timeouts • if the sender does not receive an ACK in a predetermined time the original frame is retransmitted. Data Link Networks - Part II
ARQ Algorithms • The general strategy of using ACKs and timeouts to implement reliable delivery is called Automatic Repeat reQuest (ARQ) • Two ARQ algorithms: • Stop-and-wait • Sliding Window Data Link Networks - Part II
4 Scenarios for Stop-and-Wait Problem: If there is lost/delayed ACK like in (c) and (d), sender will times-out and retransmits frame. The receiver believes it is the next frame. What to do? A 1-bit sequence number included in the header Both (a) and (b) are fine Data Link Networks - Part II
Stop-and-Wait with 1-bit Sequence Number Receiver Sender • Include a 1-bit sequence number (with values of 0 or 1) in the header • Sequence numbers used for each frame alternate • Thus, when the sender retransmits frame 0, the receiver knows that it is a second copy of frame 0 rather than the first copy of frame 1 frame 0 Time ACK0 frame 1 ACK1 frame 0 ACK0 Data Link Networks - Part II
Stop-and-Wait with 1-bit Sequence Number • Main shortcoming • Only one frame is sent at a time may underutilize the link capacity not keeping the pipe full Example: 1.5Mbps link x 45ms RTT Delay x bandwidth = 67.5Kb (~8KB). Assuming frame size of 1KB, stop-and-wait uses about one-eighth of the link's capacity. Want the sender to be able to transmit up to 8 frames before having to wait for an ACK. ( Sliding Window can do that ) Data Link Networks - Part II
Sender Receiver … ime T … Sliding Window Idea: Allow sender to transmit multiple frames before receiving an ACK, thereby keeping the pipe full.There is an upper limit on the number of outstanding (un-ACKed) frames allowed. • Allow multiple outstanding • (un-ACKed) frames • Upper bound on un-ACKed frames, called window Data Link Networks - Part II
£ SWS … … LAR LFS 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 • AdvanceLAR when ACK arrives • Buffer up to SWS frames Data Link Networks - Part II
£ RWS … … LFR LAF Sliding Window : Receiver • Maintain three state variables • receive window size (RWS) • largest acceptable frame(LAF) • last frame received (LFR) • Maintain invariant: LAF - LFR <= RWS • Frame SeqNum arrives: • if LFR < SeqNum < = LAFaccept • if SeqNum < = LFR or SeqNum > LAFdiscarded • Send cumulative ACKs Data Link Networks - Part II
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 second incarnation of 0..5 SWS < (MaxSeqNum + 1)/2 is correct rule • Intuitively, SeqNum “slides” between two halves of sequence number space Data Link Networks - Part II
Shared Access Networks Outline Ethernet (802.3) Token Ring (802.5) Wireless (802.11) Data Link Networks - Part II
Ethernet (802.3) • Xerox Palo Alto Research Center(PARC) created Ethernet in the mid-1970’s • Uses a technology called Carrier Sense, Multiple Access with Collision Detect(CSMA/CD) • Multiple Access – nodes send/receive data over a shared link • Carrier Sense – all nodes distinguish between idle/busy link • Collision Detection – node monitors transmission and detects collision Data Link Networks - Part II
Ethernet (802.3) • Beginnings in an early packet radio system called Aloha developed at the University of Hawaii • DEC, Intel, and Xerox defined a 10 Mbps Ethernet standard in 1978. This formed the basis of the IEEE standard called 802.3. • Wider collection of physical media • Faster version • 100 Mbps Fast Ethernet • 1000 Mbps Gigabit Ethernet Data Link Networks - Part II
Ethernet Physical Properties Transceiver Ethernet Cable Adaptor Host • Transceiver sends/receives data and detects when the • line is idle • Adaptor contains all the logic for the protocol • (not the transceiver) • Use Manchester encoding Data Link Networks - Part II
Ethernet Physical Properties: Terminators Hosts Repeater Repeater • Repeaters join multiple Ethernet segments • forwards signals on all outgoing segments • can support up to 4 repeaters • Terminators avoid bounce-back • Can support up to 1024 hosts Data Link Networks - Part II
Ethernet Hub Hubs • Multiway repeater (sometimes called hub) Data Link Networks - Part II
Access Protocol for Ethernet • Controls access to the shared Ethernet link • Called the Ethernet’s Media Access Control (MAC) • protocol • Usually implemented in hardware on the adaptor Data Link Networks - Part II
Ethernet Frame Format 64 48 48 16 32 • Preamble – synch bits for signal – alternating O’s and 1’s • Type – demultiplexing key (which of the higher level protocols does the frame belong?) Data Link Networks - Part II
Ethernet Addresses • Ethernet adaptors have unique addresses • Burned into ROM • Series of six one-byte numbers(a pair of hexadecimal digits) • 8:0:2b:e4:b1:2 • 00001000 00000000 0010101111100100 10110001 00000010 • Each manufacturer is assigned a 24-bit prefix • Example: Advanced Micro Devices has been assigned the 24-bit prefix 8:0:20 Data Link Networks - Part II
Ethernet Addresses • Ethernet adaptors receive all frames • Ethernet adaptors accept: • frames addressed to its own address • frames addressed to the broadcast address • frames addressed to a multicast address • all frames, if placed into promiscuous mode • (Note: an adaptor can be programmed to run in promiscuous mode) Data Link Networks - Part II
Ethernet Transmission Algorithm • The sender’s side is where the action is • If an adaptor has a frame to send and the line is idle, the frames is • transmitted immediately • If an adaptor has a frame to send and the line is busy, it waits for the line to • go idle then transmits immediately • Collision - two adaptors find the line idle do they transmit their packets • which collide • 96-bit transmission if adaptor detects collision • (64b preamble + 32b jamming sequence) • Once a collision is detected and stopped the adaptor will wait • some time and try again. • This time is called exponential backoff • - each time it tries to transmit but fails results in doubling the delay interval • between tries Data Link Networks - Part II
Collisions A B A B A B A B Data Link Networks - Part II
Experience with Ethernet • Works well for 30% or less utilization • otherwise network capacity is wasted • Most Ethernets have fewer than 200 hosts (1024 maximum) • Easy to administer, there are no: • - switches • - routers • Easy to add new hosts Data Link Networks - Part II
Network Adaptors • Network Adaptor • - framing • - error detection • - media access protocol • ARQ(Automatic Repeat reQuest) algorithm is typically handled • one layer up running on the host • Device Driver – a collection of OS routines that effectively • anchor the protocol graph to the • network hardware Data Link Networks - Part II