Direct Link Networks Reliable Transmission
Computer Network Direct Link Networks Reliable Transmission
Outline
- Direct link networks (Ch. 2)
- – Encoding – Framing – Error detection
- – Reliable delivery
- – Media access control
- – Network Adapter
Hardware Building Blocks
- Nodes
- – Hosts: General-purpose computers
- – Switches: Typically special-purpose H/W
- – Routers
- Links
- – Cooper with electronic signaling
- – Glass fibre with optical signaling
- – Wireless with electromagnetic (radio, Infra Red,
Microwave) signaling
Link
- Cooper Based Media
- – Cat 5 Twisted Pair 10 – 100 Mbps 100m
- – Thin Net Coax 10 – 100 Mbps 200m
- – Thick Net Coax 10 –100 Mbps 500m
Link
- Optical Media
- – Multimode Fibre 100 Mbps
2Km
- – Singlemode Fibre 100-2400 Mbps 40Km
Link
- Comparison Of Octical Media
- – Single mode
- Lower attenuation (longer distances)
- Lower dispersion (higher data rates)
- – Multi mode
- Easier to terminate
Link
- Advantages of optical communication
- – higher bandwidths
- – superior attenuation properties
- – immune from electromagnetic interference
- – no crosstalk between fibers
- – thin, lightweight, and cheap (the fiber, not the optical-electrical interfaces)
Link
- Wireless transmission
- – 2.4 GHz radio 11 Mbps 7Km
- – Infrared (IR) link 1 Mbps 9 m
- – Geosynchronous satellite 600-1000 Mbps continent
Services available from carriers
Encoding (line coding)
‰problems with signal transmission– attenuation: signal power absorbed by medium
- – dispersion: a discrete signal spreads in space
- – noise: random background “signals&rd
- – Problem is how are 0’s and 1’s detected at receiving node in a robust fashion
Encoding Taxonomy
- Digital data, digital signal
- – codes which represent bits
- – our focus
- – many strategies!
- Analog data, digital signal
- – sampling to represent voltages
- Digital data, analog signal
- – modulation to represent bits
- Analog data, analog signal
- – modulation to represent voltages
Non-Return to Zero (NRZ)
- 0 Æ low signal; 1 Æ high signal
- Poor clock synchronization when there is a long string of 1’s or 0’s
NRZ-Inverted (NRZI)
• 1 Æ make transition; 0 Æ stay at the current
level- Addresses clock synchronization problem for long strings of 1’s
- – still out of luck on consecutive strings of 0’s
Manchester Encoding
- Each bit contains a transition
- – 0 Æ high-to-low transition
- – 1 Æ low-to-high transition
- Used by 802.3 - 10 Mbps Ethernet
• Enables effective clock recovery at receiver
Manchester Encoding contd.
• Disadvantage: needs a clock that is twice as
fast as the transmission rate
1
1
1
1
1 Manchester Clock
4B/5B Encoding
- Tries to address inefficiencies in Manchester • Idea is to insert extra bits in bit stream to break up long strings of 0’s or 1’s
- Every 4 bits of data are encoded in 5 bit code (see text for details)
- – at most one leading 0
- – at most two trailing 0’s
- Uses NRZI to put bits on wire
- – reason why code focused on zeros
Framing
- Blocks of data (not just sequences of bits) are exchanged across links --- frames
- Problem: how to tell where a frame begins and where it ends
Character-Based Framing
- Special characters (tags) are used to indicate idle fill (ASCII SYN), start of text (STX) and end of text (ETX)
- Used by PPP (point-to-point protocol)
- Problem: what if tag characters occur in packet data
Character-Based Framing contd.
- Solution: Insert extra escape characters when a tag appears in data field
Bit-Oriented Framing
- Each frame begins with a start and end bit sequence (flag)
6
- – 01111110 = 01 0 is the usual flag
- Example: HDLC (high-level data link protocol)
- Problem: what if flag appears in body
Bit Stuffing
- Sender: inserts a 0 after five consecutive 1s
- Receiver: when it sees five 1s makes decision based on next two bits
- – if next bit 0 (this is a stuffed bit), remove it
- – if next bit 1, look at next bit
- if 0 this is end of frame (receiver has seen
01111110)
- if 1 this is an error, discard frame (receiver has seen
01111111)
Bit Stuffing Example
Framing with Length Fields
- Detecting the end of the frame done by sending length information (e.g. number of bytes in the frame) in the header
- Used by DECNET’s DDCMP
- Q: Is a flag still needed at the start of the frame ?
Digital transmission over
analog
- modulation to represent bits
- – amplitude (AM)
- – frequency (FM)
- – phase/phase shift
- – combinations of these
Error Detection
- Bit errors can be introduced in packets
- This problem has been studied for a long time
- – Error detection (and correction) codes
- – Cyclic redundancy check (CRC) is a common error detection method
- Basic idea of any scheme is to add redundant data
- – A primary goal is to send minimal amount of redundant data
- – Another goal is to make generation of code fast
Error Detection
- We use error-detecting codes to help detect errors
- Example code: Consider the function that duplicates each bit in the message
- – E.g. the message 1011001 would be mapped to the code 11001111000011, and then transmitted to the sender. The receiver knows that bits come in pairs. If the two bits in a pair are different, it declares that there was a bit error.
Parity
Parity added to make @ 1s even/odd
0 1 1 1 0 1 0 1 1 If parity is wrong ERROR If parity is right NO ERROR
(or an even number of errors has occurred) Two-Dimensional Parity
Q: If an error is detected in this scheme, is it also correctable?
Two-Dimensional Parity 1 0 0 1 0 0
1 0 0 1 0 0
Example
0 0 0 0 0 1 0 0 0 0 0 1 Two
One 1 0 0 1 0 0 1 0 0 1 0 0 errors error
1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 1
Arrows indicate failed check bits 1 0 0 1 0 0
1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 Four
1 0 0 1 0 0 Three 1 0 0 1 0 0 errors errors 1 0 0 1 1 0
1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1
Internet Checksum
• Used by IP, TCP, UDP, ...- Method
- – Break message as a sequence of 16-bit integers
- – Add these integers using 16-bit one’s complement arithmetic
- – Take the one’s complement of the result
- – Resulting 16-bit number is the checksum
- It’s simple to implement
- – Reason why it’s used despite relatively weak detection capability
Reliable Transmission
- Big Q: How do we send a packet reliably when it can be lost and/or corrupted in the network?
- Mechanisms
- – Acknowledgements – Timeouts
- Simplest reliable protocol: Stop and Wait
- – send a packet
- – stop and wait until an ACK arrives from the receiver
- – retransmit if timeout occurs before ACK arrives
Stop and Wait Recovering from Errors
Reliable Transmission
- How does the receiver recognize a duplicate transmission (e.g. in the case of a lost ACK)?
- – Solution: Put sequence number in packet
- Performance
- – No pipeline effect
- – Example
- Bandwidth-delay product = 67.5 Kb (8KB)
- 1KB packets imply 1/8th link utilization
- Solution: Sliding Window Protocols
How do we keep the pipe full?
- Send multiple packets without waiting for the first to be ACKed
• Upper bound on un-ACKed packets, called
Sender Receiver window ime T
Sliding Windows: Sender
- State
- – Packets sent and ACKed (LAR = last ACK received)
- – Packets sent but not ACKed (buffer for SWS packets)
- – Packets not yet sent (LFS = last packet sent)
- Keep LFS - LAR SWS
≤
≤ SWS
LAR LFS …
…
- Advance LAR when ACK arrives
Sliding Windows: Receiver
- State
- – Packets received and ACKed (NFE = next frame expected, LFR = last packet received)
- – Packets received out of order (buffer for RWS packets)
- – Packets not yet received (LFA = last frame acceptable)
- Keep LFA - LFR RWS
≤ RWS ≤
… LFR LFA …
What if we lose a packet?
- Selective repeat/ack (SACK)
- – Receiver sends ACK for each packet in window
- – On timeout, sender resends only the missing packet
- – Proposed for TCP
- Go back N with buffering out-of-order packets
(TCP)
- – Receiver ACKs “got up through packet k”
- If multiple packets are received, only one ACK is needed
- – Different from traditional Go back N
Sender Algorithm
- Send full window, set timeout
- On ACK
- – If it increases LAR (packets sent and ACKed)
- On timeout
- – Resend all outstanding packets starting from
LAR + 1 (first packet not yet ACKed)
Receiver Algorithm
- On packet arrival
- – If packet is the NFE (next frame expected)
- Send ACK
- Increase NFE
- Deliver packet(s) to the upper layer (could fill hole in buffer)
- – Else
- Discard if < NFE or > LFA
How to determine timeouts?
- Problem:
- – If timeout too small, useless retransmits
- – If timeout too large, low utilization (pipe not full)
- Solution:
≈
- – On direct link, timeout 2 x PROP
- – Trickier to estimate at transport layer • RTT varies with congestion, route changes, etc.
Sequence Number Space
- Recall seq # (SeqNum) cannot grow arbitrarily
- SWS MaxSeqNum - 1 is not sufficient
≤
- – Suppose 3-bit SeqNum field (0…7)
- – SWS = RWS = 7
- – sender transmits packets 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
≤
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 sender from overflowing receiver’s buffer