Chapter 2 Direct Link Networks
Hardware in Nodes
• DMA
• Programmed I/O
Typical bandwidth requirements
10Kbps
100Kbps
1Gbps
10Gbps
POTS
voiceVideo
conf
VHS
Qual
(MP4)
NTSC
B’cast
(MP4)
HDTV
B’cast
(MP4)
1Mbps
10Mbps
100Mbps
Raw
NTSC
Raw
HDTV
Common Wired Media Types and Speed
Electrical
(“Copper”)Optical
“Fiber”
Twisted
Pair
(“TWP”)
10-100 Mbps
100 m
Co-ax
Cable
10-100 Mbps
200-500 m
Multi
Mode
100 Mbps
2 km
Single
Mode
2.4 Gbps and up
40 km
Higher Bandwidth, Better Noise Immunity
Lower cost, Easier installation
Co-axial Cable
Plastic outer sheath
Braided metal sheath (ground)
Insulator
Copper signal conductor
Category 5 Twisted Pair
(“Cat5 TWP”)
Derived from telephone wire
Much cheaper, easier to work with than co-ax
Less noise immunity than coax
The dominant networking medium
Fiber optic cableThe idea: Pulsed laser light carried by glass fiber.
• Compared to copper:• Higher bandwidth
• Immunity to electrical noise
• More expensive. Harder to run and maintain
• Good for Long-Haul backbone applications
The network architecture
cpu
mem nic
modem
Office / Home
substation LocalISP
rou
ter
LAN
“LastMile
Link”
(One or a
few channels)
Regional ISP
Backbone
Providers
NetworkAccessPoints
“LongHaul
Links”
(1000’sof
Channels)
100’sof
channels
Common wired last-mile link
technologies
Analog
Voice modems 56Kbps
Digital
xDSL 128Kbps – 100Mbps
ISDN 128Kbps
Cable modems 1-40Mbps
Wireless Links
Frequency bands licensed to organizations
License-exempt
Transmission power
Spread spectrum
Frequency hopping
Direct sequence
IrDA
Encoding
Modulation
Two different voltages
Two different power levels
Data Encoding (1)
Basic encoding -- Non-Return to Zero (NRZ)
Clock
Data 0 0 0 1 0 1 1 0
NRZ
Problems
Baseline wander
Clock recovery
Data encoding (2)
Data Encoding (3) Manchester Code
0’sareL-H
transitions
1’sareH-L
transitions
A self-clockingcodeprovidesasynthetic“clock”aspartofthedatastream.The
receiver can use this to synch.
InthecaseoftheManchestercode,NRZisXORedwiththesender’sclockto
provide a clock edge in every bit period.
Data Encoding (4) 4B/5B
Address inefficiency of the Manchester
encoding
Insert extra bits into the bit stream to break
long 0s and 1s
pp83
Framing
Byte-oriented
Bit-oriented
Clock-based
IBM Binary Synchronous Communication
(BISYNC)
DDCMP
A bit-oriented protocolISO High-level Data Link Control (HDLC)
Clock-based framing protocols –
SONET (1)
Clock-based framing protocols –
SONET (2)
• Clock synchronization
• XOR data with a well-known bit pattern
STSN Multiplex/Concatenated
Error Detection
How do we detect that a frame/packet we have
received contains an error? (Error Detection)
And if we do, what do we do about it? (Error
Correction)
Error Detection
Usually done by sending redundant bits
We’dliketominimizethenumberofbitsweadd
We think about detection methods in terms of:
Numbers/types of errors detected
Efficiency (1-fraction of bits that are added for error control)
Simple parity
2D Parity
Checksum
• Checksum is calculated by adding
the data bytes
• Simple, fast for large data blocks
(files, etc.)
• Detects all single errors, many
others
• High efficiency (example: 1KB
file, 16-bit checksum 99.8%
efficiency)
Data byte
Data byte
Data byte
Data byte
Data byte
Checksum
+
Internet Checksum Algorithm
Cyclic Redundancy Check (CRC) (1)
CRC (2)
• Very high efficiency
• Detects single, double, all odd errors
• Adding “r” CRC bits allows detection of burst errors of
r-1 bits
• Complex-looking arithmetic, but easily implemented in
hardware (pp97)
• Used in many networking applications
• 6 versions are widely used (pp101)
Reliable delivery
We want the protocol to implement
“reliable”framedelivery(asopposedto
“besteffort”delivery)
By“reliable”,wemeanthatframesare:
All delivered
In order
Without bit errors
Fundamental Mechanisms
Acknowledgments
Timeouts
Retransmit
Flow Control Algorithms
Flow control is essential for ensuring that data
is successfully delivered (one part of reliable
data delivery)
Flow control is the set of rules that ensure
thatreceiversaren’toverwhelmedwithdata
(their receive buffers do not overflow)
LLCprotocolalgorithmsareoftencalled“flow
controlalgorithms”
The simplest possible algorithm
(Simplex)
Sender:
As data is passed from the layer above, pack it
into frames and send it.
Receiver:
When a frame is received, unpack it and pass the
data to the layer above.
Simplex Algorithm Operation
ABCD
A
A
BCD
CD
B
AB
D
C D
ABD
In Simplex, the sender doesn’t know
whether or not the receiver has actually
received a frame. This leads to out-of-
order data.
Try: Acknowledging each framee e e e
Simplex + Acknowledgements
The idea:
When the receiver receives a frame, it sends
anacknowledgement(“ACK”)framebackso
that the sender knows the frame was received.
The sender will wait until the previous frame is
ACKed before sending the next one.
Simplex + Acknowledgements:Operation
ABCD
A
A
BCD
CD
B
AB
Cack ackThis version deadlocks because the sender will
wait forever for an ACK after a lost frame.
Try: Adding timeouts
e e e
Simplex + ACKs + timeouts
The Idea:
When the sender sends a frame, it starts a
timer. If the timer times out before the ACK is
received, the sender will re-send the last frame.
Simplex + ACKs + timeouts:Operation (1)
A
B
C
D
A
A
B
C
D
C
D
B
A
B
Cack ack
Timeout interval
C ack
A
B
C
Resend
e e e e
Simplex + ACKs + timeouts:Operation (2)
A
B
C
D
A
A
A
A
A
ack ack
Timeout interval
This algorithm gets confused when an ACK is lost. When the
sender doesn’t get an ACK for the last frame sent, it times out
and resends that frame. The receiver does not recognize that it
has gotten two copies of the same frame.
Try: An indicator to show when a frame is repeated
Resend
e e
Stop-and-wait Automatic Repeat
Request (stop-and-wait ARQ)
The Idea:
The receiver needs to be able to determine
when it has received the same frame twice in a
row.We’lladdaflagtotheframethat
alternatesbetween”1“and.”0“Thisway,ifthe
receiver gets two frames in a row that have the
same flag, it will know that this is two copies of
the same frame and can ignore one of them.
Stop-and-Wait ARQ:Operation (1)
A
B
C
D
A
A
B
C
D
C
D
B
A
B
Cack ack
Timeout interval
C
D
C ack
A
B
C
0 1 0
Last Flag=0 Last Flag=1
0
Last Flag=0
e e e e0 1 0 0
Stop-and-Wait ARQ:Operation (2)
EFGH
E
E
FGH
E
E
ack ack
Timeout interval
0 0
Last Flag=0 Last Flag=0
F
EF
ack1
Last Flag=1
EFGH
0 0 1e e e
Four Cases
Success!!
We now have a protocol, Stop-and-wait ARQ, that will reliably transfer a frame across the link.
Now, what about efficiency? (Example pp104)
The Go-Back-N Algorithm
The efficiency problem with S-a-W ARQ is due to the link being idle
while we wait for an ACK.
The Idea:
While we are waiting for the ACK for a frame, send out the next frames
up to a total of “N”. This will fill the idle time on the link.
If we receive no ACK for a frame, we will re-send that frame and the N-1
after it. We must number the frames so that the receiver will know which
frame it is getting and so that it can specify which frame it is ACKing.
Go-Back-NOperation (1)
ABCD
A
N=3
AB
ABC
ABCD
EF
BCDEF
CDEF
DEF
ABCDE
ABCDEF
Window defined
by last_sent and
last_acked
Go-Back-NOperation (2)
A
B
C
D
A
N=3
E
F
B
C
D
E
FTimeout
Wrong sn.
Ignore
Wrong sn.
IgnoreA
B
C
D
E
F
A
B
C
Better Efficiency, but still a problem
To maximize efficiency, we want to set N large enough so that the link is filled
while we’re waiting for the ACK (RTT+)
As the length of the link grows, RTT increases and we increase N to maintain
high efficiency.
But the higher N grows, the more frames we have to re-send after an error.
For an error-prone link, this can cancel any efficiency gains.
Example:
100Mbps link with RTT = 10 msec, Frames1000 bits long.
Each frame takes 1000 bits / 100 Mbps = 10 usec to send.
For max efficiency, set N >= 10msec / 10usec = 1000.
Assume we send 106 frames. x% have errors the first time they are sent.
If x=0 it takes 10 sec to send successfully.
If x=0.1%, 103 frames will be in error,
so 103 x 1000 = 106 frames will be re-sent for a total of 2 x 106 frames.
so it will take 20 seconds to send successfully.
The Sliding Window Algorithm
The Idea:
When an error is detected, only the frame in error is re-sent.
(Note that this means the receiver must be able to receive frames out-of-
order and order them correctly -- a simple FIFO queue doesn’t work).
Detail:
– Implicit ACKs: If the receiver ACKs receiving frame F, that means F and
all preceding frames are ACKed
– The receiver can control data flow by withholding ACKs. This is usually
implemented as a “receive window size” that can be different from the
“send window size”
Sliding Window AlgorithmOperation (1)
A
B
C
D
A
Send Window Size=3
A
B
A
B
C
A
B
C
D
E
F
B
C
D
E
F
D
E
F
A
B
C
D
E
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
Receiver can
choose not to
ACK for flow
control purposes
1
2
3
4
5
6
Sliding Window AlgorithmOperation (2)
A
B
C
D
A
Window size=3
E
F
B
C
D
E
FTimeout
C
D
E
F
1
2
3
4
5
6
A
C
1
2
3
4
5
6
A
C
D
1
2
3
4
5
6
A
B
C
D
1
2
3
4
5
6
Success!!(…Really!)
The Sliding Window Algorithm provides reliable data
transfer with excellent efficiency
We’ll see it again in TCP
Something to notice about
Sequence Numbers Assume frame sequence numbers are encoded with n bits
Then they will roll over every 2n frames
Wecan’taffordtoeverhavetwoframes“inflight”withthesame
sequence number
The implications are far-reaching:
Send window size can never be greater than 2n-1
Send and receive buffers must hold at least 2n-1 frames
As network speeds increase, we can can have more and more
frames in flight -- the 2n-1 limit becomes more important
AppPresSessTransNetDLPhy
Media Access Control (MAC) Sublayer
Performs Data Link functions that depend
on the type of medium used
Performs Data Link functions that are
independent of the type of medium used
Logical Link Control (LLC) Sublayer
The data link layer is usually thought of (and often
implemented) as two distinct sublayers performing
different functions
The MAC Sublayer
Computer
NIC
Computer
NIC
Computer
NIC
Shared LANs
Network
Interface
Card
Shared Medium
A key thing to realize:
Every node on the LAN sees
every frame of data
Ethernet The most common LAN technology
IEEE Standard 802.3
Simple electronics, simple protocols
Versions with Bandwidths from 10Mbps to 10Gbps
Nomenclature:
100 Base T
Bandwidth in Mbps
(10, 100, 1000, 10000, 100000)
Type of Medium
“2” = Thinnet Coax
“5” = Thicknet Coax
“T” = Twisted pair
“F” = Optical fiber
Computer
Tap
Computer
Computer
Ethernet wiring
Coax
Computer Computer Computer Computer
Hub
Twisted
pair
How does Ethernet work?
The basic ideas:
– carrier sense (CS): Every station can tell if the line is idle
– multiple access (MA): All stations have equal access to the line
– collision detection (CD): Stations monitor the line while they send.
They can tell if there is a “collision” with another station’s frame.
(This is called “listen while talk”)
= “CSMA/CD”
PreambleDestination
AddressSource
AddressType/SIze
Data
8 6 6 2 0 to 1500 4bytes:
6-byte MAC addresses
(e.g., 04:A2:61:B4:CD:00)
Destination addresses with
high-order bit = 1 are multicast
addresses. All 1’s is a
broadcast.
Every MAC address is unique
world-wide
101010….
used as a
synch signal
CRC-32
error
detection
Pad
0 to 46
An Ethernet frame can
carry up to 1500 bytes of
data.
The frame, exclusive of
Preamble, must be at least
64 bytes long.
So there must be at least
46 bytes in the Data field.
If there are fewer, pad
bytes are added.
#
bytes
in
Data
field
Ethernet frame format
CRC
Example Ethernet frames
DestinationAddress
SourceAddress
100 Data
6 6 2 100 4
CRC
100 bytes of data
DestinationAddress
SourceAddress
10 Data
6 6 2 10 4
10 bytes of data
Pad
36
CRC
Data field padded to 46 bytes
Ethernet MAC Algorithms
SEND
While there are frames to send
Listen for a period of time (“Inter-Frame Gap”).
If line is idle, then
Listen while sending the frame.
If there is a collision while sending then
send a “Jamming signal” and stop
wait an amount of time determined by the “exponential backoff” algorithm
End
End
End
RECEIVE
When the start of a frame is sensed
Check the destination address. Copy the frame into the receive buffer if:
1. It is addressed to my MAC address, or
2. It is a broadcast frame, or
3. It is a multicast frame addressed to my multicast group, or
4. I am in “promiscuous” mode
Sending a frame
Sender senses the line and find it idle
t=0 Begins sending to a node at the
far end of the LAN
t=d
Call the end-to-end latency of
the ethernet “d”
t=2d
The amount of time needed to
send a frame can’t be less than
2d (we’ll see why later)
Collisions
Two nodes sense the line and find it idle.
Assume they are at the opposite
ends of the Ethernet.
t=0Both begin sending
t=d/2
The frames “collide”
The result of the collided frames is an
interference pattern that is gibberish.
The gibberish propagates throughout the
Ethernet.
t=d
The sending nodes, doing “listen while
talk” see that the data on the line doesn’t
match what they are sending. This tells
them a collision has occurred.
A Bt=0
t=d- t=2d
t=d
t=d+
The “longest” collision
Two nodes, A and B, at opposite ends of the Ethernet. A sends, then B sends just
as A’s frame reaches B
In order for A to know about the collision of a frame sent at t=0, A has to still be sending at
t=2d.
This means that frames must be long enough to take at least 2d to send.
Ethernet parameters
The parameters of a particular type of Ethernet are specified in the particular IEEE
standard. These are usually set as a result of engineering trades and safety margins
(and they usually don’t match the theoretical values).
Parameters:
- Min length of a frame
- Min time required to send the min frame (“slot time”)
- Max length of the Ethernet (coax) or of connections to the hub (TWP)
- Max number of computers, repeaters, etc
10Mbps 512 bits 51.2 uS
Min frame length Slot time
100Mbps 512 bits 5.12 uS
1Gbps 4096 bits 4.096 uS
1
2
3
n
Number
of
collisions
in a row
0 or 1
0, 1, 2, or 3
0,1,2,3,4,5,6 or 7
0…2n-1
Number of Slot times
colliding senders will
wait before re-trying
0.5
0.25
0.125
2-n
Probability of
another collision
on the next round
The Exponential Backoff algorithm
Problem:
After a collision, how long do the senders wait before trying again? We need a way to stagger or
randomize their wait intervals, but we want to minimize the wait times.
Exponential Backoff Algorithm forces senders to wait a # of slot times that is randomly picked from a
list. The list grows as the number of successive collisions grows. After n collisions, there are 2n
numbers in the list.
Note: n is limited so that NIC failures can be detected (type: n<=16).
Token Ring (IEEE 802.5)
A
C
BD
Frames are passed from node to node around the
ring.
There is a special “token” frame that circulates on the
ring.
To send, a node waits for the token, removes it from
the ring, sends its frame, then replaces the token.
A
C
BD
To: C
A
C
BD
To: C
A
C
BD
To: C
A
C
BD To: C
A
C
BD
To: C
A
C
BD
To: C
Token Ring operation
Dearly
release
SD AC ED
1 1 1
Token
SD AC* ED
1 1 1
Bit flipped to indicate
that this is a data frame,
not the token
Dest Addr Src Addr Data Checksum ED FS
6 6 no limit 4 1 1
Token Ring operation
Note similarity to Ethernet frame, especially MAC
address fields
Some Token Ring Parameters
4 and 16 Mbps
250 stations per ring max
Token Holding Time (max time a node can
hold the token -- prevents hogging):
default=10msec
A problem with token rings
When there is a break anywhere in the
ring, all communication everywhere is lost
Fiber Distributed Data Interface (FDDI)
Dual counter-rotating rings
provide some ability to tolerate
a broken ring
FDDI Parameters
• 100 Mbps
• 500 stations max
• up to 2 Km between stations
Wireless
• Wireless technologies, pp134
• Topology
• Mobility – 3 levels
Some Characteristics
Bluetooth
• 2.45GHz
• Piconet
• Request and response
• Parked, low-power state
The idea: a wireless version of the Ethernet
Standards Developed by IEEE
AKA“WiFi”
Compatiblewithother802’satL3
802.11 Background
Basic 11a 11b 11g 11n
Released 1997 1999 1999 2003 2008
Freq. band 2.4Ghz 5Ghz 2.4GHz 2.4GHz 2.4, 5GHz
Max data
rate2 Mbps 54 Mbps 11 Mbps 19 Mbps 600 Mbps
Max Range(approx)
100m 100m 150m 150m 250m
802.11 standards
Some major differences from Ethernet
Most radios are half-duplex,socan’tListen
While Talk, so no CD
Sowecan’tuseCSMA/CD
Hidden node problem prevents CS
Astationcan’tbeassuredofhearingother
stations that are in range of a destination
Exposed node problem
Note: Collision Avoidance, not Detection
The protocol:
–(RTS)”SendtoRequest“broadcastssendtowishingStation.1
identifies desired receiver and length of message*
–(CTS)”SendtoClear“broadcastsReceiver.2 identifies sender and
length
3. Sender knows it can proceed with transmit. Any other station that
hears the CTS knows it must stay silent.
4. Sender proceeds with transmit.
signalaisThis.”ACK“broadcastsreceiver,transmissionofendAt.5
to other stations that they can try an RTS.
* If there is a collision between two RTS’s, the receiver will hear garbage and
will not CTS. Senders will time out and retry according to Exponential
Backoff Algorithm.
Multiple Access Collision Avoidance for Wireless (MACAW)
Probe
Probe Response
Association Request
Association Response
Base-Station-Oriented
WiMax (802.16)
Last mile technology 1-6 miles
Line-of-sight and nonline-of sight
10-66 GHz
Mobility
Connection oriented
Up to 75Mbps