CSIS0234A Computer and Communication Networks
Direct Link Network Point-to-point
Point-to-point
1
Readings Peterson
et. al, Computer Networks – A System Approach, 3rd edition, Morgan Kaufmann.
Chapter 2
Stallings, Data and Computer Communications, 7th Edition, Prentice Hall
W.
Sections 3.2 and 3.4
B.A.
Forouzan, Data Communications and Networking, 3rd Edition, McGraw-Hill
Point-to-point
Sections 10.3, 11.3 and 11.4
2
Terminology Direct
link
No intermediate devices
Simplex
Point-to-point
Direct link
Only 2 devices share link
Half
Signals
Electric or electromagnetic representations of data
Transmission
Point-to-point
Communication of data by propagation and processing of signals
One direction
duplex
Either direction, but only one way at a time
Full
e.g. Television
e.g. police radio
duplex
Both directions at the same time
e.g. telephone 3
Signals Physical
medium carries signals by which data are propagated
electromagnetic waves
Signals
Analog signal – Continuously variable
Signal intensity varies in a “smooth and continuous” fashion over time
Point-to-point
can be analog or digital
e.g. Sine Wave
Digital signal – Discrete values
Maintains a constant level then changes to another constant level
Use two DC components 4
Analog & Digital Transmission Analog
signal transmitted without regard to content
Maybe
analog/digital data
May
become weaker (attenuated) over distance
Use amplifiers to boost signal
Also
Point-to-point
amplifies noise
audio or video data – quality deteriorate but still “usable”
Concerned
with content
Integrity
endangered by noise, attenuation etc.
Repeaters
used
Repeater receives signal
Recovers bit pattern
Retransmits the digital signal
Attenuation Noise
is overcome
is not amplified
digital data – introduce errors
5
Advantages of Digital Transmission Data
integrity
Using repeaters remove the effects of noise
Longer distances over lower quality lines
Capacity
utilization
High degree of multiplexing easier with digital techniques
Using statistical multiplexing rather that frequency division
Security
& Privacy
Encryption
Integration
Can treat analog and digital data digitally
Economics of scale as integration of voice, video, and digital data
Point-to-point
6
Channel Capacity Data
rate - In bits per second
Rate at which data can be communicated
Bandwidth
Any transmission system has a limited band of frequencies
Constrained by transmitter and medium
Bandwidth Wc is range of frequencies passed by the communication channel
Noise
Average level of noise over the communication channel
Error
Point-to-point
rate
The rate at which errors occur 7
Spectrum
Point-to-point
8
Nyquist Bandwidth A
noise free channel
If rate of signal transmission is 2Wc then signal with frequencies no greater than Wc is sufficient to carry signal rate
Bit Rate = 2 x 3000 = 6000 bps
Given binary signal
Two signal levels
Data rate supported by Wc Hz is 2Wc bps
Point-to-point
Consider a noiseless channel with a bandwidth of 3000 Hz transmitting a signal with two signal levels. The maximum bit rate can be calculated as
For
a given bandwidth, can data rate be increased?
How?
9
Multilevel Signaling With
two signal levels, each pulse carries one bit of information
Bit rate = 2Wc bits/second
With
M = 2m signal levels, each pulse carries m bits Bit rate =
2Wc pulses/s * m bits/pulse = 2Wc m = 2 Wc log2 M bps
Example of multilevel signals
Four levels {-1, -1/3, 1/3, +1} for {00, 01,10,11}
Waveform for 11,10, 01 sends +1, +1/3, -1/3
Consider the same noiseless channel, transmitting a signal with four signal levels (for each level, we send two bits). The maximum bit rate can be calculated as:
Bit Rate = 2 x 3000 x log2 4 = 12,000 bps Point-to-point
10
Practical limitation
Receiver needs to distinguish M (2m) possible signal elements during each signal time
Error rate depends on relative value of noise amplitude and spacing between signal levels
If transmitted power is limited, then as M increases, spacing between levels decreases
Presence of noise at receiver causes more frequent errors to occur as M is increased
Point-to-point
11
Signal-to-Noise Ratio Presence of noise limits accuracy of measurement of received signal amplitude signal
signal + noise
noise
High SNR
noise
signal
virtually error-free signal + noise
Low SNR error-prone Bit Error Rate (BER) increases with decreasing signal-to-noise ratio Point-to-point
SNR =
Average Signal Power Average Noise Power SNR (dB) = 10 log10 SNR
12
Shannon Channel Capacity
Consider the relationship among data rate, noise and error rate Faster data rate “shortens” each bit so burst of noise affects more bits
Signal to noise ratio (in decibels)
At given noise level, high data rate means higher error rate
Arbitrarily reliable communications is possible if the transmission rate R < C.
If R > C, then arbitrarily reliable communications is not possible.
“Arbitrarily reliable” means the BER can be made arbitrarily small through sufficiently complex coding.
C can be used as a measure of how close a system design is to the best achievable performance.
SNRdb = 10 log10 (signal/noise)
Capacity C = Wc log2(1+SNR)
Point-to-point
13
Example We can calculate the theoretical highest bit rate of a regular telephone line. A telephone line normally has a bandwidth of 3000 Hz (300 Hz to 3300 Hz). The signal-to-noise ratio is usually 3162. For this channel the capacity is calculated as
C = Wc log2 (1 + SNR) = 3000 log2 (1 + 3162) = 3000 log2 (3163) = 34,860 bps
Point-to-point
14
Example We have a channel with a 1 MHz bandwidth. The SNR for this channel is 24dB; what is the appropriate bit rate and signal level? First, we use the Shannon formula to find our upper limit. SNRdB = 24 dB = 10 log10(SNR) SNR = 251 C = 1 MHz log2 (1 + 251) = 106 log2 252 ≈ 8 Mbps
This is a theoretical limit, is unlikely to be reached. But assume we can achieve the limit. Then we use the Nyquist formula to find the number of signal levels. 8 Mbps = 2 × 1 MHz × log2 M M = 16 Point-to-point
15
Line Coding Signals
How to represent the 1s and 0s by the electrical or light pulses
Digital
propagate over a physical medium signal
Discrete, discontinuous voltage pulses
sent as a series of "square waves" of either positive or negative voltage.
e.g. Voltages vary between +3/-3 to +24/-24, depending on the circuit.
Each pulse is a signal element
We are encoding the binary data by a signal element or a group of signal elements
Each
digital transmission standard defines
What voltage levels correspond to a bit value of 0 or 1.
Which encoding scheme it is using
Point-to-point
16
Non-Return-to-Zero (NRZ) Two
different voltages for 0 and 1 bits
Voltage
remain constant during “bit interval” – no transition
i.e. no return to zero voltage
Examples:
Unipolar NRZ – Absence of voltage for zero, constant positive voltage for one
Polar NRZ – Negative voltage for one value and positive for the other
Long
strings of 1 or 0
Poor timing – unable to recover clock
Low-frequency content B its
Point-to-point
NR Z
0 0 1
0 1
1
1
1
0 1
0 0 0 0 1
0
17
Differential Coding The
information is encoded as a change of signals between successive data symbols rather than the signal levels
Non-return
Makes a transition from the current signal to encode a one, and stay at the current signal to encode a zero
Point-to-point
to Zero Inverted (NRZI)
Data encoded as presence or absence of signal transition at beginning of bit time or at the middle of bit time
Solves the problem of consecutive ones
18
Manchester code Every
interval has transition in middle - mid-bit transition.
Transition serves as clock and data representation One is Zero is
Pros
Cons Self clocking Error detection Absence of expected transition
Double the bandwidth
Used
in 10-Mbps Ethernet & other LAN standards
Point-to-point
19
4B/5B coding
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
resulting 5-bit codes are transmitted using NRZI
No problem with consecutive 1s
achieves 80% efficiency
Never get more than 3 consecutive 0s
Using 5 signal elements to encode 4 bits
Used by 100Base-TX and FDDI
Point-to-point
20
Framing The
physical layer is moving data as a sequence of bits
Upper
layers work with a block of data, not bit streams
The
data link layer needs to find some way to break the sequence of bits into a frame
Typically
implemented by network adaptor B its
Node A
A daptor
A daptor
Node B
Frame s
Point-to-point
21
Approaches (1) Sentinel-based
Delineate frame with special pattern
Byte-Oriented: e.g. PPP
Frames consist of integer number of bytes
Bit-Oriented: e.g. HDLC
a collection of bits, is not concerned with byte boundaries
Problem: special pattern appears in the payload
Solution
Byte-Oriented: byte stuffing
Point-to-point
22
Approaches (2)
Problems with byte stuffing ✖ ✖
Size of frame varies unpredictably due to byte insertion Malicious users can inflate bandwidth by inserting those control/escape characters
Bit-Oriented: bit stuffing, e.g. 01111110
sender: insert 0 after five consecutive 1s
receiver: when it detects a 0 that follows five consecutive 1s, delete it ✖
if after five 1s, next bits are 10: frame marker ☛
If next bits are 11: error
Data received
01111110000111011111011111011001111110 Data to be sent
0110111111111100
After destuffing and deframing
*000111011111-11111-110*
After stuffing and framing
0111111001101111101111100001111110 Point-to-point
23
Approaches (3) Counter-based
include payload length in header
e.g. DECNET's DDCMP 8
8
8
14
42
Count
H e ade r
16 B ody
problem:
count field corrupted
solution:
catch when CRC fails
Point-to-point
CR C
24
Question Suppose
the following sequence of bits arrives over a
link: 1101011111010111110010111110110 Show the resulting frame after any stuffed bits have been removed.
Point-to-point
25
Error Control How
to make sure the integrity of all received frames ?
Error control
For reliable communication, errors must be detected and corrected
Error types include corrupted data and missing data
Error control is concerned with: 1) detecting AND 2) correcting errors.
Point-to-point
Tell the sender if error occur -- feedback
Sender cautiously waits for feedback -- timing
Which frames we are currently handling -- labeling/sequencing
Two basic approaches:
Error detection & retransmission (ARQ)
Forward error correction (FEC) 26
Errors Single
bit errors
One bit altered
Adjacent bits not affected
Burst
errors
Length B
Contiguous sequence of B bits in which first last and any number of intermediate bits in error
Impulse noise
Fading in wireless
Effect is greater at higher data rates
Point-to-point
27
Key Idea All
transmitted data blocks (“codewords”) satisfy a pattern
If
received block doesn’t satisfy pattern, it is in error
Redundancy:
the amount of information that is transmitted is over and above the required minimum
Blindspot:
when channel transforms a codeword into another codeword All inputs to channel satisfy pattern or condition
User Encoder information Point-to-point
Channel
Channel output
Pattern checking
Deliver user information or set error alarm
28
Error Detection Process At the receiving end, the error detection value is recalculated and checked against the received value If they differ, an error has occurred
Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination
An error detection value is first calculated by the sender and transmitted along with the data
Point-to-point
29
Single Parity Check Parity
checking is one of the oldest and simplest error detection techniques
Append
an overall parity check to k information bits
For even parity, the sum of the bits (including the parity bit) remains even
For odd parity, the sum remains odd
Receiver
All error patterns that change an odd # of bits are detectable
Parity
Point-to-point
checks to see if # of 1s is even or odd
checking is simple, but doesn't catch all errors.
If two (or an even number of) bits have been changed at the same time, the parity check appears to be correct even though an error has occurred.
30
Two-Dimensional Parity Check More
parity bits to improve coverage
Adds
an additional character of parity checks, called a block control character (BCC) to each block of data.
The
BCC parity calculations are based on the 1st bit, 2nd bit, etc.
Catching
over 98% of all errors, but still misses a 1 0 0 1 0 0 significant number of errors. 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0
Last column consists of check bits for each row
1 0 0 1 1 1 Bottom row consists of
Point-to-point
check bit for each column
31
Error-detecting capability 1 0 0 1 0 0
1 0 0 1 0 0
0 0 0 0 0 1
0 0 0 0 0 1
1 0 0 1 0 0
One error
1 0 0 1 0 0
1 1 0 1 1 0
1 0 0 1 1 0
1 0 0 1 1 1
1 0 0 1 1 1
1 0 0 1 0 0
1 0 0 1 0 0
0 0 0 1 0 1
0 0 0 1 0 1
1 0 0 1 0 0 Three errors 1 0 0 1 1 0
1 0 0 1 0 0
1 0 0 1 1 1
1 0 0 1 1 1
1 0 0 0 1 0
Arrows indicate failed check bits
Point-to-point
Two errors
1, 2, or 3 errors can always be detected; Not all patterns >4 errors can be detected Four errors (undetectable)
32
Internet Checksum
Several Internet protocols (e.g. IP, TCP, UDP) use check bits to detect errors in the header
A checksum is calculated and included in a special field
Algorithm selected for ease of implementation in software
View message M as a sequence of 16-bit integers
Add all these integers using 16-bit ones complement arithmetic X = ( b0 + b1 + b2+ ...+ bL-1 )
Ones complement addition, carryout from most significant bit is added to result 1010 1100 10110 0111
Point-to-point
33
Verifying Internet Checksum
Then take the ones complement of the result bL = - X
In ones complement, negative number is represented each bit inverted 0101 → 1010
Resulting 16-bit number is the checksum
On
the receiver side
Do the same checksum operation on the received message M' 0 = - ( b0 + b1 + b2+ ...+ bL-1 + bL )
Point-to-point
34
Example Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one’s complement 10101001 169 00111001 57 -----------Sum 11100010 226 Checksum 00011101 29 The pattern sent is 10101001 00111001 00011101 Now suppose the receiver receives the pattern and there is no error. 10101001 00111001 00011101 When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 169 00111001 57 00011101 29 Sum 11111111 255 Complement 00000000 means that the pattern is OK.
Point-to-point
Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 00011101 When the receiver adds the three sections, it gets 10101111 175 11111001 249 00011101 29 Partial Sum 111000101 453 Carry 1 Sum 11000110 198 Complement 00111001 57 the pattern is corrupted.
Usually, Internet checksum uses a 16-bit word, not 8-bit
35
Cyclic Redundancy Check (CRC)
Add k bits of redundant data to an n-bit message
We want k n+1 > m+r+1;
e.g., for m=7, r >= 4
Useful for one way transmissions or when transmission times are very long (e.g., communications to spacecraft)
Hamming Code - one example of FEC techniques
Point-to-point
39
Hamming Code Extra
parity values are calculated so that each data bit figures into at least two parity bit calculations
This means that if any one bit, either parity or data, gets changed in transmission, the change in the received data can be detected and corrected
The secret of error correction is to locate the invalid bit
This
technique, however, only works for one bit errors
Point-to-point
The bits that are powers of 2 are check bits 40
Hamming Code (2)
Point-to-point
A bit (at pos k) is checked by those check bits which sum equal to k. e.g., 11 = 1 + 2 + 8
41
Example Data - 1001101
Code - 10011100101 Point-to-point
42
Error Correction via Retransmission Detect
error, correct by retransmission
The
process of requesting that a data transmission be resent is called an Automatic Repeat Request or ARQ
Basic elements of ARQ:
Error-detecting code with high error coverage
Acknowledgment
Main
ACKs (positive acknowledgments)
NAKs (negative acknowledgments)**
Timeout mechanism
ARQ protocols are:
Stop-and-Wait
Sliding Window - Go-Back N & Selective Repeat
Point-to-point
43
Stop-and-Wait Source
transmits single
frame
Wait for ACK
Destination
Replies with ACK
ACK damaged/lost,
Transmitter will retransmit
Problem: Receiver gets two copies of frame
Question: How to differentiate?
receives
frame
If
If
received frame damaged, discard it
Transmitter has timeout, retransmit
Question: How long would the sender wait?
Point-to-point
44
Need for Sequence Numbers (a) Frame 1 lost
A B (b) ACK lost
A B
Time-out
Frame Frame 0 1 ACK
Frame Frame 1 2 ACK
Time-out Frame Frame Frame Frame 0 1 1 ACK 2 ACK ACK
Time
Time
In cases (a) & (b) the transmitting station A acts the same way But in case (b) the receiving station B accepts frame 1 twice Question: How is the receiver to know the second frame is also frame 1? Answer: Add frame sequence number (1-bit) in header Put the current sequence number in the header
Point-to-point
45
Sequence Numbers (c) Premature Time-out
Is this acknowledgment for Frame 1 ??
Time-out A
Frame 0 ACK
B
Time Frame 0
ACK
Frame 1
Frame 2
The transmitting station A misinterprets duplicate ACKs
Incorrectly assumes second ACK acknowledges Frame 1
Question: How is the receiver to know second ACK is for frame 0?
Answer: Add frame sequence number in ACK header
the sequence number of next frame expected by the receiver
Point-to-point
46
Stop-and-Wait Model
A
t0 = total time to transmit 1 frame
B
tprop
tproc
frame time tf
tproc
tack
tprop bits/info frame
t 0 = 2t prop + 2t proc + t f + t ack bits/ACK frame nf na = 2t prop + 2t proc + + R R
First bit enters channel Last bit enters channel First bit arrives at receiver Last bit arrives at receiver Channel idle while transmitter waits for ACK
Point-to-point
channel transmission rate
47
Transmission Efficiency bits for header & CRC
Effective transmission rate: R eff =
n f −n0 Number of information bits delivered to destination = Total time required to deliver the information bits t0
Transmission efficiency: n f − no
η0=
Point-to-point
Reff R
=
t0 R
= 1+
na + nf
Extra overhead in carrying ACK frame
no 1− nf . 2(t prop + t proc ) R
Effect of frame overhead – loss in transmission efficiency
nf Effect of Delay-Bandwidth Product
48
Example nf=1250 bytes = 10000 bits, na=no=25 bytes = 200 bits 2xDelayxBW Efficiency
1 ms
10 ms
100 ms
1 sec
1 Mbps
200 km 103
2000 km 104
20000 km 105
200000 km 106
1 Gbps
88% 106
49% 107
9% 108
1% 109
1%
0.1%
0.01%
0.001%
Stop-and-Wait does not work well for very high speeds or long propagation delays Point-to-point
49
Sliding Window Improve Keep
channel busy by continuing to send frames
Allow
Stop-and-Wait by not waiting!
a window of up to window un-ACKed frames
Frame transmission are pipelined to keep the channel busy
Assign
sequence number to each frame
If
receive ACKs before window is exhausted, we can Se nde r R e ce ive r continue transmitting
Point-to-point
50
Sender's Sliding Window Frames transmitted and ACKed
LAR
...
LFS
LAR + SWS
LFS - LAR