Title: CS3502: Computer Communications and Networks
1CS3502 Computer Communications and Networks
2Data Link Control
- To accomplish reliable, efficient communication
between two adjacent machines - Dealing with stream of bits
Point to point communication channel (bits could
be inverted during transmission)
bit stream 101010001..
Machine A(transmitter)
Machine B(receiver)
3Data Link Functions
- Perform tasks to achieve reliability
- error detection and control
- making sure that receiver will get the original
bit sequence - flow control
- making sure that transmitter will not overwhelm
receiver by sending bits too fast - Incur delays
- processing delays
- communication delays
- e.g., transmitter waiting for acknowledgements
from receiver
4Framing
- To facilitate error detection and correction, it
is more efficient to partition a bit stream into
frames - Asynchronous transmission
- fixed-length frames (called characters) e.g.,
ASCII characters - start and stop bits used to mark each character
at the physical level - advantage(s)
- simple encoding (e.g., based on voltage levels)
is used - problems
- stringent timing requirement at the physical
level when character size is large - large communication overhead when character size
is small
5Framing (contd)
- Synchronous Transmission
- Large variable-length frames (called blocks) are
used - no start and stop bits
- how to determine the beginning and end of a
block? - preamble and postamble bit patterns e.g.,
01111110 - what if the bit stream contains the
preamble/postamble bit pattern? - bit stuffing .01111110 gt 011111010...
- Block size cant be too large
- receiver buffer limitation
- the larger the frame size, the more likely the
frame contains bit errors
6Flow Control
Geoffrey Xie Assuming no transmission errors
- Stop-and-Wait
- Acknowledgement based
- will not send next frame until obtaining (from
receiver) acknowledgement on correct reception of
previous frame - Problems
- only one frame can be in transit at any time
- very inefficient, especially for a high speed link
7Flow Control (contd)
- Sliding Window
- Allow multiple frames in transit at the same time
- sequence numbers are used to keep track which
frames have been successfully received - Maximum window size
- the maximum number of frames that can be transit
at the same time - cannot exceed
- the amount of buffer space at the receiver
- the range of sequence numbers
8Error Detection
- Types of errors (for both data and
acknowledgement frames) - lost frame
- damaged frame, i.e., containing bit error(s)
- Definitions
- frame size F
- probability of a single bit error Pb
- Probability that a frame arrives with no bit
errors P1 - Probability that a frame arrives with undetected
bit error(s) P2 - Probability that a frame arrives with only
detected error(s) P3 - P1 (1 - Pb)F
9Error Detection (contd)
- P2 could be too high with no error detection
- for example, when Pb 10-6 and F 1000, we
have P2 1 - P1 10-3 - Goal of error detection
- reduce P2 for a fixed Pb
- General approach of error detection
- add error detection code (bits) to each frame
(see Figure 6.5 of text)
10Error Detection (contd)
- Parity Check
- Appending a parity bit to the end of each frame
- even or odd parity (regarding number of 1s in
frame) - Cannot detect even number of errors
- P2 Prthere are even number of bit errors in
frame - P3 1 - P1 - P2
11Error Detection (contd)
- Extended Parity Check (Hamming Code)
- Multiple parity bits are used
- in each position (of frame) corresponding to a
power of 2 1, 2, 4, 8, - rest are data bits p1p2d3p4d5d6d7p8...
- Can detect and correct single bit error
- building the following matrix to determine p bits
given d bits(transmitter choosing p values so
that each row has even parity) p1
d3 d5 d7 ... p2 d3 d6 d7 ...
p4 d5 d6 d7 ... ...
12Error Detection (contd)
- Cyclic Redundancy Check (CRC)
- n-bit frame check sequence (FCS) appended to
k-bit frame (M) so that new frame is divisible by
predetermined (n1)-bit value (P) - modulator 2 arithmetic (addition/subtraction is
equivalent to XOR operation) - Suitable for hardware implementation
- Example
- M 1010001101 (k10 bits), P 110101 (6 bits),
n 52n M 101000110100000R the remainder of
(2n M / 110101) 01110(2n M R) is
transmitted
13Error Detection (contd)
- Internet Checksum
- Adds up all the words and append the sum to
frame - Software implementation (at higher layers)
- Weaker than CRC in detecting errors
- e.g., will not detect reordering of words
14Error Control
- Based on Retransmission also called Automatic
Repeat reQuest (ARQ) - Triggered by negative acknowledgement (NACK)
- Triggered by timeout
15Error Control (contd)
- Stop-and-Wait ARQ
- Avoid acceptance of duplicate frames
- alternatively label data frames with 0 or 1
(Figure 6.8 of text)
16Error Control (contd)
- Go-back-N ARQ
- Work with sliding window flow control
- receiver discarding multiple frames ( see
Figure 6.9 of text, ignoring the RR (P bit 1)
message ) - transmitter re-transmit multiple frames
17Error Control (contd)
- Selective Reject (or Selective Repeat)
- More efficient in terms of link usage
- only retransmit lost or damaged frames (see
reference book 1)
18Comparison of Link Protocols
- Focus on link utilization performance
- Assume
- protocol processing time is negligible
- time to transmit an ACK or NACK message is
negligible - frame size is constant (L bits)
- Define
- tframe time to transmit a frame, i.e, send out
all the bits - (L / R) where R is the data rate of the link
- tprop link propagation time
- constant a tprop / tframe
19Performance of Link Protocols
- Stop-and-Wait
- Flow control alone
- U 1 / (1 2a)
- With ARQ
- U (1 - P) / (1 2a) where P is the
probability that a single frame is in error
20Performance (contd)
- Sliding Window (window size being N)
- Flow control alone
- U 1 when N gt 2a 1, N / (1
2a) otherwise - With ARQ
- Go-back-NU (1 - P) / (1 2aP) when N gt 2a
1, N(1 - P) / (2a 1)(1 - P NP)
otherwise - Selective Reject U (1 - P) when N gt 2a 1,
N(1 - P) / (2a 1) otherwise
21Local Area Network
- Packet broadcasting network using a share
transmission medium
Host 2
Host 1
Shared medium
Host 3
..
Host N
22LAN Architecture
- IEEE 802 Reference Model (Figure 12.1 of text)
- Medium Access Control (MAC)
- govern access to shared medium
- framing, addressing, and error detection
- Logical Link Control
- flow and error control
- logically separated from MAC, i.e., several MAC
options may be provided for the same LLC
23LAN Topologies
- Wire Based Topologies
- Bus
- each host tapping into a linear transmission
medium - terminators at the end of bust to remove old
signals - Tree
- branching cable with no closed loops
- Ring
- host attached to a repeater
- data circulated around in one direction
- Star
- all hosts connected directly to a common central
node (star coupler) - either broadcasting or switching
24Medium Access Control
- Goal
- resolve contention while achieving high network
utilization - Where to put control?
- centralized
- distributed
- How to control?
- synchronous techniques
- e.g., TDM
- not good because of bursty data generation by
host - asynchronous techniques
- round robin
- reservation
- contention
25Ethernet
- Carrier-Sense Multiple Access with Collision
Detection (CSMA/CD) - IEEE 802.2 MAC standard
- carrier-sense
- sender listening to channel and transmit only if
detecting an idle channel - Successor of ALOHA protocols
- collisions allowed
- better efficiency
- maximum achievable utilization for ALOHA is only
about 18
26Aloha Protocol
- Users allowed to transmit whenever they have data
- not a carrier sense protocol
- colliding frames are useless and will be
discarded - Collision happens even when the first bit of a
new frame overlaps with just the last bit of the
frame in such a case, both frames have to be
retransmitted - Each sender waits a random amount of time before
retry upon collision - Performance
- U G e-2G where G average number of
transmission attempts per frame time - maximum value of U is 1/2e 0.18 when G 0.5
27Slotted Aloha Protocol
- Time divided up into discrete intervals
- Users must transmit at beginning of a time slot
- require clock synchronization
- Performance
- U G e-G
- maximum of U is 1/e .368 when G 1
28CSMA/CD
- Senders abort transmissions as soon as the detect
a collision - bandwidth not wasted on transmitting garbled
frames - frame size should be large so that collision
detection happens way before end of transmission - require collision detection
- sender compares received signals with ones that
it transmitted
29CSMA/CD Rules
Listen to channel
yes
no
transmit
Is channel idle ?
Listen to channel
collision?
no
yes
Transmit jamming signal
Perform random wait
30Token Ring
- IEEE 802.5 standard
- collision avoidance based on token passing
(Figure 13.5 of text) - host starting transmission only after it gets
hold of token and not releasing token until
transmission is successful - token-holding timer to prevent one host from
monopolizing token - performance similar to round robin under heavy
load - when majority of stations have data to send
- token maintenance must be reliable
- to prevent loss or duplication of token
- one host acting as a monitor
31Fiber Distributed Data Interface (FDDI)
- Similar to IEEE 802.5
- Designed for high data rate (e.g., 100 Mbps)
- token frame separate from data frames
- data frames are ready to go in buffer
- early token release
- host to release token as soon as it completes
data transmission, not waiting for the
transmitted frame to loop back
32FDDI Capacity Allocation
- Each host guaranteed a minimum period of
transmission time each time it gets hold of
token - Definitions
- Target Token-Rotation Time TTRT
- Synchronous Allocation time for host i SAi
- constant propagation time for circuit of ring
DMax - time required to transmit token frame
TokenTime - time to transmit maximum length frame FMax
- Allocation condition
- DMax FMax TokenTime S SAi lt TTRT
33FDDI Rules
- Each host maintains
- Token-rotation timer TRT initialized to TTRT
and count down - Token-holding timer THT
- Late counter LC initialized to 0 used to
detect error - Upon receiving token
- 1. THT lt TRT LC lt 02. TRT lt
TTRT3. enable TRT4. transmit synchronous
frames for up to SAi time - 5. enable THT and transmit asynchronous frames
until THT 0
34Performance of CSMA/CD and Token Ring
- Appendix 13.B of text
- CSMA/CD
- U 1 / ( 1 2a(1-A)/A )
- where A ( 1 - 1/N )N-1 with N being the total
number of hosts - U 1 / ( 1 3.44a ) for large N
- Token ring
- U 1 / ( 1 a/N ) when a lt1, 1 / ( a(a
1/N) ) otherwise
35Bridging
LAN A
. . .
A Bridge
Data units MAC frames
LAN B
. . .
36A 4-Port Bridge
LAN 1
Port 1
LAN 4
LAN 2
Port 2
Port 4
Port 3
LAN 3
37Bridge Operations
- Frame forwarding between different LANs
- routing
- forward every frame to appropriate LAN
- participation in MAC control of each LAN
connected - behave just like a host in each LAN
- frame format conversion
38Routing with Bridges
- Fixed (static) routing
- routing table preloaded into each bridge
- is simple and requires minimal processing
- not flexible
- Spanning tree routing
- routing tables being automatically built and
updated
39Spanning Tree Routing
- Initial setup
- flooding
- Frame forwarding (Figure 14.8 of text)
- each bridge maintains a filtering database
record format (DA, Output-Port, Timer) - Address Learning
- use source addresses
- assuming a tree network topology
- build a spanning tree first for an arbitrary
topology
Making sure the route is fresh
40Wide Area Networks (WANs)
Data units packets
Network node
Sender host/station
Receiver host/station
. . .
41Switched Networks
- Circuit switching (legacy telephony)
- dedicated communication path set up between the
stations - path consisted of a sequence of links between
network nodes - one logical channel dedicated to the connection
at each link - e.g., each link uses Time Division Multiplexing
to operate such channels - Packet switching (current technology)
- data are transmitted in short packets
- each packet stored and forwarded by a sequences
of network nodes - different packets may go through different
sequences of nodes - much more efficient for bursty data traffic
42System model of a packet switching network node
Packets queued in buffer before their turn for
transmission
43Routing in WAN
- Routing -¾ finding a communication path from
source to destination - Must be scalable
- there can be millions of hosts in a WAN
- Must be robust
- many things could go wrong in a WAN
- fixed routing alone would not work
44Packet Switching Networks
- Two routing approaches (Figure 9.3 of text)
- connectionless (datagram)
- connection-oriented (virtual circuit)
- Performance measures
- total network delay of a packet queueing delay
propagation delay transmission delay - packet losses due to buffer overflow
45Virtual Circuit
- End-to-end connection is set up before data
transmission - all packets for one user session carry a unique
connection id in header - routing table indexed by connection id
- N2-scaling problem
- How many possible connections are there for N
stations? N (N-1)
46Datagram Routing
- Connectionless
- each packet is treated independently by the
network - routing table indexed by destination address
- robust
- unreliable service
- quality of service may vary from one packet to
another - packets may be out of order at the receiver
- rely on transport layer to perform error control
47Asynchronous Transfer Mode (ATM)
- Connection-oriented signaling
- virtual channel (VC) connections
- virtual path (VP) connections
- semi- permanent, user controlled or network
controlled - aggregation of virtual channels (Figure 11.2 of
text)solve the N2-scaling problem with
hierarchical routing - Small fixed-size packets
- 5-byte header and 48-byte payload (Figure 11.4 of
text) - Quality of Service (QoS) support
48A 4 x 4 ATM Switch
Input ports
Output ports
Upstream node
downstream node
Switch fabric
49Internet Routing
- Hierarchical routing (Figure 16.10 of text)
- network partitioned into Autonomous Systems
(ASs) - Interior Router Protocol (IRP) passes routing
information within an AS - Open Shortest Path First (OSPF) algorithm
- Exterior Router Protocol (ERP) passes routing
information between ASs - Border Gateway Protocol (BGP)
50Internet Protocol (IP)
- IP (version 4) header (Figure 16.7 of text)
- IP address hierarchy (Figure 16.8 of text)
- network classes A, B, C
- facilitate hierarchical routing
- IPv6 (Ipng) will use 128-bit addresses
- Subnets
- user defined address hierarchy
51Unicast, Multicast and Anycast
- Unicast
- single destination
- Multicast
- multiple destinations
- need to minimize packet duplications
- multicast routers and IP tunneling
- Anycast
- closest one among a set of destinations
52Transport Protocols
- Required because of unreliable services at
network layer - connection management
- flow control
- error detection and control
53Transmission Control Protocol (TCP)
- Data units TCP segments
- TCP header format (Figure 17.14 of text)
- 3-way handshake for connection management
- sender and receiver exchanging SYN packets
- Sliding window flow control
- Reliable service based on acknowledgement/retransm
ission - Congestion control window
54TCP 3-way handshake
- Two-way handshake is sufficient if network
service is reliable, i.e., if there is no delayed
duplicate of a connection request or a connection
acknowledgement. (Figure 17.7 and 17.8 of text) - Active/Passive open
- Each side to acknowledge explicitly the others
SYN and sequence number (Figure 17.13 of
text) - receiver asking sender if the ACKed connection is
the right one - receiver not entering Connected state until its
SYN is ACKed
55TCP Socket Interface
- Transport Service Access Point (TSAP) consists of
- IP address
- port number --- application/user address
- System routines
- open/connect/close
- listen/bind
- send/receive
56Example Socket Program
57Application-Level Protocols
- File Transfer Protocol (FTP)
- Telnet
- HyperText Transfer Protocol (HTTP)
- used for Web documents
- Simple Mail Transfer Protocol (SMTP)
- used for email messages
- Simple Network Management Protocol (SNMP)
58R2
R1
R3
R4