Title: Direct Link Networks
1Direct Link Networks
Textbook Computer Networks A Systems Approach,
L. Peterson, B. Davie, Morgan Kaufmann Chapter
2.
2Direct Links Outline
- Physical Layer
- Link technologies
- Encoding
- Link Layer
- Framing
- Error Detection
- Reliable Transmission (ARQ protocols)
- Medium Access Control
- Existing protocols Ethernet, Token Rings,
Wireless
3Link Technologies
- Cables
- Cat 5 twisted pair, 10-100Mbps, 100m
- Thin-net coax, 10-100Mbps, 200m
- Thick-net coax, 10-100Mbps, 500m
- Fiber, 100Mbps-2.4Gbps, 2-40km
- Leased Lines
- Copper based T1 (1.544Mbps), T3 (44.736Mbps)
- Optical fiber STS-1 (51.84Mbps), STS-N
(N51.84Mbps) - Last-Mile Links
- POTS (56Kbps), ISDN (264Kbps)
- xDSL ADSL (16-640Kbps, 1.554-8.448Mbps), VDSL
(12.96Mbps-55.2Mbps) - CATV 40Mbps downstream, 20Mbps upstream
- Wireless Links Cellular, Satellite, Wireless
Local Loop
4Encoding
- Signals propagate over a physical medium
- modulate electromagnetic waves
- e.g., vary voltage
- Encode binary data onto signals
- e.g., 0 as low signal and 1 as high signal
- known as Non-Return to zero (NRZ)
5Problem Consecutive 1s or 0s
- Low signal (0) may be interpreted as no signal
- High signal (1) leads to baseline wander
- Receiver compares rx_signal to avg_signal
- Clock drift Unable to recover clock
6Alternative Encodings
- Non-return to Zero Inverted (NRZI)
- make a transition from current signal to encode a
one stay at current signal to encode a zero - solves the problem of consecutive ones
- Manchester
- transmit XOR of the NRZ encoded data and the
clock - only 50 efficient.
7Encodings (cont)
8Encodings (cont)
- 4B/5B
- every 4 bits of data encoded in a 5-bit code
- 5-bit codes selected to have no more than one
leading 0 and no more than two trailing 0s - thus, never get more than three consecutive 0s
- resulting 5-bit codes are transmitted using NRZI
- achieves 80 efficiency
9Framing
- The physical layer provides a mean to transmit a
sequence of bits - How can one determine the beginning/end of a
frame? - Solutions
- Character-based framing (use special control
characters) - Bit-oriented framing with flags
- Length counts
- Clock based
10Character Based Framing
- BISYNC BInary SYNchronous Communication
- SYN Synchronous idle, SOH Start of Header, STX
Start of text, ETX End of text - Problem 1 if control characters appear within
the header, or CRC. - These are known locations, one can skip control
characters in these fields - Problem 2 if CTRL characters appear in the
packet. - Use a Data Link Escape (DLE) character before ETX
when it appears within the packet - If DLE appears within the packet replace it with
DLE DLE.
11Bit Based Framing
- Sentinel-based (Bit oriented)
- delineate frame with special pattern 01111110
- e.g., HDLC, SDLC
- problem special pattern appears in the payload
- solution bit stuffing
- sender insert 0 after five consecutive 1s
- receiver delete 0 that follows five consecutive
1s - Disadvantage potentially increases the length by
20
12Counter Based Framing
- include payload length in header
- e.g., DDCMP
- problem count field corrupted
- solution catch when CRC fails
13Clock Based Framing
- SONET Synchronous Optical Network
- Each frame is 125 micro-seconds long 810 bytes
for STS-1 - STS-n (STS-1 51.84 Mbps)
14Direct Links Outline
- Physical Layer
- Link technologies
- Encoding
- Link Layer
- Framing
- Error Detection
- Reliable Transmission (ARQ protocols)
- Medium Access Control (MAC)
- Existing protocols Ethernet, Token Rings,
Wireless
15Error Detection
- Bits can get corrupted on transmissions
- How to detect, and if possible, correct them
- Error detection techniques
- Parity bit
- Internet checksum
- Cyclic redundancy check (CRC)
16Parity Bit
- Simplest of all techniques
- Single parity bit
- Add a bit that takes the XOR of all the data bits
- What kind of errors can it detect?
- Two dimensional parity
- Arrange the data in a 2D matrix
- Take the parity along each row and row column
- Send the data with the parity bits
- What kind of errors can it detect?
17Internet Checksum Algorithm
- View message as a sequence of 16-bit integers
sum using 16-bit ones-complement arithmetic take
ones-complement of the result.
u_short cksum(u_short buf, int count)
register u_long sum 0 while (count--)
sum buf
if (sum 0xFFFF0000)
/ carry occurred, so wrap around
/ sum 0xFFFF
sum
return (sum 0xFFFF)
18Cyclic Redundancy Check
- Add k bits of redundant data to an n-bit message
- want k ltlt n
- e.g., k 32 and n 12,000 (1500 bytes)
- Represent n-bit message as n-1 degree polynomial
- e.g., MSG10011010 as M(x) x7 x4 x3 x1
- Let k be the degree of some divisor polynomial
- e.g., C(x) x3 x2 1
19CRC (cont)
- Transmit polynomial P(x) that is evenly divisible
by C(x) - shift left k bits, i.e., M(x)xk
- subtract remainder of M(x)xk / C(x) from M(x)xk
- Receiver polynomial P(x) E(x)
- E(x) 0 implies no errors
- Divide (P(x) E(x)) by C(x) remainder zero if
- E(x) was zero (no error), or
- E(x) is exactly divisible by C(x)
20Selecting C(x)
- All single-bit errors, as long as the xk and x0
terms have non-zero coefficients. - Any odd number of errors, as long as C(x)
contains the factor (x 1) - Any burst error (i.e., sequence of consecutive
error bits) for which the length of the burst is
less than k bits. - Most burst errors of larger than k bits can also
be detected - See Table 2.6 on page 102 for common C(x)
21Direct Links Outline
- Physical Layer
- Link technologies
- Encoding
- Link Layer
- Framing
- Error Detection
- Reliable Transmission (ARQ protocols)
- Medium Access Control (MAC)
- Existing protocols Ethernet, Token Rings,
Wireless
22Reliable Transmission ARQ
- Automatic Repeat reQuest (ARQ)
- Underlying physical channel
- Each transmitted frame may be delayed by an
arbitrary and variable time - Some frames might be lost and may never arrive
- Assume that error detection works correctly
- Frames that arrive are assumed to do so in order,
with or without errors (this assumption is not
always necessary, true for direct links) - Correctness of ARQ protocol each packet is
released to the network layer once and only once,
without error - Efficiency Use of link bandwidth (effective
throughput)
23Acknowledgements Timeouts
24Stop-and-Wait
Sender
Receiver
- Sender ensures that each frame is received
correctly before sending the next frame. - How to distinguish between successive packets?
- Use sequence numbers
- But sequence numbers may grow out of bound?
- A 1-bit sequence number suffices for
Stop-and-Wait!
25Problems with Stop-and-Wait
- Keeping the pipe full
- Example
- 1.5Mbps link x 45ms RTT 67.5Kb (8KB)
- 1KB frames implies 1/8th link utilization
- How to keep the pipe full?
- Send more frames without waiting for acks
26Sliding Window
- Allow multiple outstanding (un-ACKed) frames
- Upper bound on un-ACKed frames, called window
27Sliding 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 lt SWS
- Advance LAR when ACK arrives
- Buffer up to SWS frames
28Sliding Window Receiver
- Maintain three state variables
- receive window size (RWS)
- largest frame acceptable (LFA)
- last frame received in order (LFR)
- Maintain invariant LFA - LFR lt RWS
- Frame SeqNum arrives
- if LFR lt SeqNum lt LFA accept update LFR,
if necessary - if SeqNum lt LFR or SeqNum gt LFA
discarded - Send cumulative ACKs
- Buffer up to RWS packets
29Buffer Sizes
- SWS set to bandwidth-delay product estimate
- For RWS, two common settings
- RWS 1 receiver will not buffer any frames that
arrive out of order - RWS SWS
- Does not make sense to set RWS gt SWS
30Sequence Number Space
- SeqNum field is finite sequence numbers wrap
around - Sequence number space must be larger then number
of outstanding frames - If RWSSWS, SWS lt MaxSeqNum-1 is not sufficient
- suppose 3-bit SeqNum field (0..7)
- SWSRWS7
- 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 lt (MaxSeqNum1)/2 is correct rule
- Intuitively, SeqNum slides between two halves
of sequence number space
31Concurrent 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
- Separates reliability from order
- Data link layer protocol used in ARPANET
32Direct Links Outline
- Physical Layer
- Link technologies
- Encoding
- Link Layer
- Framing
- Error Detection
- Reliable Transmission (ARQ protocols)
- Medium Access Control (MAC)
- Existing protocols Ethernet, Token Rings,
Wireless
33Medium Access Control Protocols
Multiple Access Protocols
Contention
Conflict-free
Dynamic Resolution
Static Resolution
Dynamic Allocation
Static Allocation
Token Passing
Time of arrival
Reservation
ID
Probabilistic
Probabilistic
34MAC Protocols Evaluation
- Throughput
- Delay
- Buffering
- Stability
- We also generally assume that
- channel is errorless
- feedback is available
35Carrier Sense Protocols
- Use the fact that in some networks you can sense
the medium to check whether it is currently free - 1-persistent CSMA
- non-persistent CSMA
- p-persistent protocol
- CSMA with collision Detection (CSMA/CD)
- 1-persistent CSMA
- when a station has a packet
- it waits until the medium is free to transmit the
packet - if a collision occurs, the station waits a random
amount of time - first transmission results in a collision if
several stations are waiting for the channel
36Carrier Sense Protocols (Contd)
- non-persistent CSMA
- when a station has a packet
- if the medium is free, transmit the packet
- otherwise wait for a random period of time and
repeat the algorithm - higher delays, but better performance than pure
ALOHA - p-persistent protocol
- when a station has a packet wait until the medium
is free - transmit the packet with probability p
- wait for next slot with probability 1-p
- better throughput than other schemes but higher
delay - CSMA with Collision Detection (CSMA/CD)
- stations abort their transmission when they
detect a collision - e.g., Ethernet, IEEE802.3
37Ethernet
- History evolution from Aloha, CSMA, CSMA/CD (by
Xerox PARC) gt Ethernet, gt IEEE802.3 (Digital,
Intel, Xerox) - There are slight differences between Ethernet and
802.3 (e.g., 802.3 length field is used for
packet type in Ethernet, various transmission
speeds for 802.3 from 1 to 10Mbps) - Physical layer (10Mbps Ethernet)
- Manchester encoding (bit synchronous, no-dc
component) - Cabling maximum 500 meters with up to 4
repeaters (max 2500m)
10Base5 Thick coax 500 m 100 nodes Good for backbones
10Base2 Thin coax 200 m 30 Cheapest system
10Base-T Twisted pair 100 m 1024 Easy maintenance
10Base-F Fiber optics 2000 m 1024 Between buildings
38Frame Format (IEEE802.3)
- Preamble 7x10101010 (allows the receivers
clock to synchronize) - SF 10101011
- 10Mbps has only 6 bytes addresses
- Unicast unique per adaptor (ranges are allocated
to manufacturers) - Broadcast FFFFFFFFFFFF
- Multicast first address bit 1
- Internet Multicast 01005e000000 -to-
01005e7fffff - Pad minimum frame length of 64 bytes
39Ethernet Algorithm
- Receiver accepts frames with a correct CRC
- Sender CSMA/CD 1-persistent algorithm
- If the adaptor has a frame and the line is idle
transmit, otherwise wait until idle line then
transmit - If a collision occurs
- When detected a 32-bit jamming sequence is sent
- Binary exponential backoff select a random
number ? 0, 2i-1 and waits for that many slots
before transmitting - After ten collisions the randomization interval
is frozen to max 1023 - After 16 collisions the controller throws away
the frame - What is the reason for having a minimal frame
length? (Hint RTT 51.2ms)
40Ethernet Performance
- Assume that retransmissions occur with
probability p, k stations ready to transmit - Probability that a station acquires the channel
Akp(1-p)k-1 - Maximum when p1/k, k-gt? A-gt1/e
- Probability that a contention interval has
exactly j slots is A(1-A)j-1 - Mean number of slots per contention is 1/A -gt e
2.718 - Slot duration 2t 51.2ms
- Channel efficiency P/(P2te), where P is
transmission time for a packet
41Ethernet Performance
42Ethernet Capture Effect
- A and B have a large queue of packets
- There exists a situation where B will keep
increasing its backoff interval (and finally
dropping its packet) while A is transmitting its
packets - One of the reasons why frame is dropped after 16
collisions
43Token Passing MAC
- Token Bus (IEEE802.4)
- broadcast bus
- logical ring
- token special control frame
- only the token holder station can transmit frames
- 0, 2, 4, 6 traffic priority classes
- Token Ring (initiated by IBM gt IEEE802.5 gt
FDDI) - token regenerated/modified at each node
- stations have two modes
- listen (forwards bits with delay 1)
- transmit (seizes the first token by transforming
into the start of frame)
44Token Ring
45Token Ring (cont)
- Idea
- Frames flow in one direction upstream to
downstream - special bit pattern (token) rotates around ring
- must capture token before transmitting
- release token after done transmitting
- immediate release
- delayed release
- remove your frame when it comes back around
- stations get round-robin service
- Frame Format
46Fiber Distributed Data Interface
- Evolution of IEEE802.5
- Designed for fiber (100Mbps) but also supports
coax and twisted pair - Architecture dual ring
- Tolerates one broken link or one station failure
- Stations buffer at least 9 bits and at most 80
bits - Uses 4B/5B encoding
- Specific Timed-Token Algorithm
47Token Times
- Token Holding Time (THT)
- upper limit on how long a station can hold the
token - Token Rotation Time (TRT)
- how long it takes the token to traverse the ring.
- TRT lt ActiveNodes x THT RingLatency
- Target Token Rotation Time (TTRT)
- agreed-upon upper bound on TRT
48Token Maintenance
- Lost Token
- no token when initializing ring
- bit error corrupts token pattern
- node holding token crashes
- Generating a Token (and agreeing on TTRT)
- execute when join ring or suspect a failure
- send a claim frame that includes the nodes TTRT
bid - when receive claim frame, update the bid and
forward - if your claim frame makes it all the way around
the ring - your bid was the lowest
- everyone knows TTRT
- you insert new token
49Maintenance (cont)
- Monitoring for a Valid Token
- should periodically see valid transmission (frame
or token) - maximum gap ring latency max frame lt 2.5ms
- set timer at 2.5ms and send claim frame if it
fires
50Ad Hoc Wireless Networks
- Physical transmission spread-spectrum radio and
diffused infrared - Key issue collision avoidance, as for the
Ethernet - More complex than the Ethernet because the nodes
are not directly connected with one another - Multi-hop network
- Potential problems
- Hidden terminal problem
- Exposed terminal problem
51802.11 Multiple Access with Collision Avoidance
(MACA 1990)
- MACA is designed for ad-hoc wireless networks
- When a station S1 has a packet to transmit to
station S2 - S1 senses the channel. If the channel is busy
defers the transmission until idle - if channel is idle S1 sends a special packet
called Request-To-Send (RTS) to S2 - (if the RTS is correctly received by S2) S2 sends
a Clear-To-Send (CTS), CTS includes the frame
length - (if the CTS is correctly received by S1) S1
starts the data transmission - Stations which sense
- RTS defer transmission until after CTS
- CTS defer transmission until the transmission of
data completes - If a station does not receive CTS in response to
its RTS, it invokes an exponential backoff