Вы находитесь на странице: 1из 56

WOLLEGA UNIVERSITY

College of Engineering and Technology


Data Communication and
Computer Networking

Chapter Two
Physical & data link layer
Physical & data link layer
Application L7: Application
TCP/IP L6: Presentation OSI
L5: Session
Transport L4: Transport
Internet L3: Network

L2: Data Link


L1: Physical
The physical layer

L2: Data Link


L1: Physical
Transmission impairements
o Distortion
 Various frequency components of a
signal arrive at different times

 Intersymbol interference: some


signal components of one bit might
spill over into other bit positions
Transmission impairements
o Noise = unwanted signals introduced by the
transmission system and add to transmission
signal
 Thermal noise
• Noise in function of temperature
 Crosstalk
• E.g. electrical coupling between nearby twisted pairs
 Intermodulation noise
• Different frequencies f1 and f2 at the same medium might
generate signals at f1+f2 and/or f1–f2
 Induced/impulse noise
• Noise pikes of short duration and high amplitude
 primary source of errors in digital data
Transmission impairements
o Noise
Transmission impairements
o Signal-to-noise ratio:
 SNR = avg signal power / avg noise power
 SNRdb = 10 log10 (SNR)

 Example: signal = 10mW / noise = 1microW


• SNR = 10000 / 1 = 10000
• SNRdb = 10 log10 (10000) = 40db
Transmission impairements
o Attenuation = signal strength reduction
in function of distance
Transmission impairements
o Attenuation in dB
 dB = 10 log10 (P2 / P1)

 Example
• Attenuation in the transmission cable is -0.3dB/km
• Transmission signal: 2mW
• Power after 5km?

• dB = 5 x -0.3dB = 10 log10 (?? / 2mW)


• 10-0.15 x 2mW = 1.4mW
Transmission impairements

o Analog transmission + impairements


 signal quality degrades

o Digital transmission + impairements


 bit errors
Channel capacity
o What’s the data rate (bps) of a
communication channel?

 Available bandwidth?

 signal levels?

 Quality of the communication channel?


Channel capacity
o Nyquist law

Assumption: noise-free communication

C = 2 B log2 M

C = channel capacity (bps)


B = bandwidth
M = number of discrete signals (e.g. voltage
levels)
Channel capacity
o Nyquist law: example
 Noiseless channel with bandwidth 20KHz is
used to send 265kbps

C = 2 B log2 M

 265000 = 2 x 20000 x log2 M

 M = 98.7 levels  128 levels!


Channel capacity
o Shannon formula

C = B log2 (1 + SNR)

C = channel capacity (bps)


B = bandwidth
SNR = signal-to-noise ratio
Channel capacity
o Shannon formula: example
 Telephone line has a bandwidth of 3000Hz and SNR of
3162

C = B log2 (1 + SNR)

 3000 x log2 (1 + 3162) = 34.860bps


Channel capacity
o Shannon formula
 Defines the characteristics of the
transmission channel
 Doesn’t say anything about the method of
transmission to reach this maximum rate

o Nyquist law
 Indicates the number of signal levels to reach
Shannon’s capacity limit
Channel capacity
o Example
 Telephone system has a typical signal-to-
noise ratio of approx. 30dB and a B of 3kHz
• Shannon: C = 30000bps theoretical max

• To reach this max, Nyquist law says:


 log2 M = 5  #signal levels = 32

 Compression is used to achieve higher data


rates
Transmission types
o Digital signals and digital transmission is
preferred these days
 Cheaper technology
 More reliable: see later (transmission
impairements)
 Higher capacity: easier and cheaper to
multiplex transmission signals for very high
bandwidth links
 Security: easier to apply encryption
techniques
Signal encoding
Signaling of bits
o The physical layer provides a conversion
between data (bits) and electrical
(optical, ...) signals
o Digital transmission
 Digital data to digital signal
 Analog data to digital signal: codecs
o Analog transmission
 Digital data to analog signal: modems
 Analog data to analog signal
Digital data to digital signals
o Data rate
versus signal
rate
 Data rate =
rate at which
data elements
(=bits) are
transmitted
(unit: bps)
 Signal rate
(moduation
rate): rate at
which signal
elements or
pulses are
transmitted
(unit: Baud)
Digital data to digital signals
o NonReturn to Zero-Level (NRZ–L)
 0 bit is sent as a high value
1 bit is sent as a low value
• Can be also inverted
o NonReturn to Zero Invert on ones (NRZI)
 Transition at the beginning of bit indicates a 1
 No transition indicates 0
Digital data to digital signals
o Multilevel binary encodings
 Bipolar-AMI
• 0 is no line signal
• 1 is positive or negative puls; successive 1s result
in pulses that alternate in polarity
 Pseudoternary
• 1 is no signal
• 0 : alternating positive and negative pulses
Digital data to digital signals
o Manchester code
 Transition at the middle of a bit period
• Low-to-high = 1
• High-to-low = 0
 Might also be inverted
Analog data, digital signals

Nyquist sampling theorem

The sampling rate must be at least 2


times the highest frequency contained
in the signal

 Signal with an infinite bandwidth can’t


be sampled
Analog data, digital signals
o Introduction of quantiziation errors

 SNRdb = 6.02 × bits + 1.76dB

Or: every extra bit increases SNRdb with 6dB


Analog data, digital signals
o Example: bit rate needed to send
digitized voice (analog voice: 4kHz) over
telephone line that must have an SNRdB
above 40?
 How many bits to digitize voice?
• SNRdb = 40 = 6.02 ×bits + 1.76dB  #bits = 6.35
 typical 7 or 8 bits are used
 How many samples?
• 2 * 4000 = 8000 samples/second
 Bit rate of digital signal: 8 * 8000  64kbs
Multiplexing
Multiplexing
o What: transmission of multiple communication
sessions over a common medium
o Why: reduces the number of ‘wires’ required to
maintain many communication sessions at the
same time
Overview techniques
o Frequency division multiplexing
o Time division multiplexing
 Synchronous
 Asynchronous

o OFDM (orthogonal frequency division multiplexing)


o Code division multiplexing
 Example: frequency-hopping spread spectrum, direct-
sequence spread spectrum, …
o Space division multiplexing
 Using multiple antennas
 Example
• multiple-input and multiple-output (MIMO)
• single-input and multiple-output (SIMO)
• multiple-input and single-output (MISO)
 see ‘Wireless communication’
Frequency division multiplexing (FDM)
o Each communication channel uses its own
frequency carrier
Frequency division multiplexing (FDM)
o Example: cable TV, broadcast radio&TV
o Broadband system
 High bandwidth transmission system is
required to send many signals at a time over
the medium
Wave division multiplexing (WDM)
o Wave division = ‘frequency division’
applied to optical transmission systems
(i.e. color division)
The data link layer

L2: Data Link


L1: Physical
Data link tasks
Communication @data link layer is between directly
connected hosts (transmitter / receiver)

o Error control
o Flow control
o On a shared link: addressing
o Link management: initiate, maintain, and
terminate data exchange connections
o Multiplex link control information and data
communication on the same link
Data link services
o Connectionless, unacknowledged service
 Unreliable communication
o Connectionless, acknowledged
 Reliable communication
 Piggybacking
• Return ACK in data packet
o Connection-oriented service
 Reliable communication
Flow Control
o Stop-and-wait protocol
 After transmission of a frame, the sender has
to wait before sending a new frame until an
acknowledgement frame is sent back by the
receiver
• Simplest control flow protocol
• Inefficient use of transmission medium
Flow control: stop-and-wait
Flow Control: sliding window
o With the use of multiple frames for a
single message, the stop and wait
protocol does not perform well. Only one
frame a time can be a transit
o sliding window flow protocol allowing
multiple frames to be a transit at the
same time.
Flow Control: sliding window
Flow Control: sliding window
o flow control: sliding window protocol
Error detection and correction
o Types of transmission errors
 Single bit errors
 Error bursts
• Errors tend to occur in group in a small period of
time (e.g. light switch is pulled on) i.s.o.
independently of each other

burst
Sent: 0100010001000011
Received: 0101110101100011

+ : only a few frames become corrupted (i.s.o. many


frames)
- : more difficult to detect and to repair
Error detection and correction
o BER = bit error rate
 #error-bits compared to #send-bits
o Error checking is often done at frame
level
 FER = frame error rate
o Example: BER of 10-3 per second
 1 bit in 1000 will be corrupted
 Frame size 125 bytes  FER = 1
• Frame size too long for this BER
Error detection and correction
o Parity check
 Even parity bit: parity bit is choosen such that the
total number of 1s in the data +parity bit is even
• Example: 0100101 -> p=1
0101101 -> p=0
• Changes to an even number of bits are not detected
 Odd parity

Only ‘odd’ numbers of bit errors can be detected

Commonly used for asynchronous and


character-oriented synchronous communication
Error detection and correction
o Checksum
 Detects more errors than parity check, but
not every error is detected
• 4-bit checksum example

Received data: every 2nd


Send data
bit is reversed
Error detection and correction
o CRC (cyclic redundancy check)
 Example:
• N-bit CRC
• M-bit pattern P
• Frame F
• Transmitted frame: F+CRC
 CRC is N-bits such that the resulting message is
‘divisible’ (Mod-2 arithmetic ~ XOR) by the bit
pattern P
• The receiver ‘divides’ the incoming msg by the
same bit pattern
Error detection and correction
o CRC (cyclic redundancy check)
 Popular CRC patterns
• CRC-16 ( 10001000000100001 )
• CRC-32 ( 100000100110000010001110110110111 )
 Cheap HW can do CRC computation  fast
technique
 CRC detects more errors than checksum
• Single bit and double errors
• Odd number of errors
• Burst errors
Error control
o Frame error types
 Lost frame: detection?
 Damaged frame
 sequence numbers and error detection

o Common error control techniques:


 Positive acknowledment: receiver sends a positive ack
for each received, error-free frame
 Negative acknowledment and retransmission: receiver
sends a negative ack for each received frame with an
error; transmitter retransmits this frame
 Retransmission after time-out: transmitter retransmits
a frame that has not been ack after a time-out
 ARQ (automatic repeat request)
Error control
o Flow control can be extended to cover
error control
 Stop-and-wait ARQ
 Go-back-N ARQ
 Selective-reject ARQ
Error control
o Stop-and-wait ARQ
 1-bit sequence number
 Retransmission timer
 Sender needs to buffer
frames until ACK
 simple but inefficient

duplicate
frame 1
Error control
o Go-back-N ARQ
 Combined with sliding-
window flow control
 If no error, ACK as usual
 If error:
• Case 1: frame error
• Case 2: frame lost
• Case 3: ACK lost
• Case 4: REJECT lost
Error control
o Go-back-N ARQ
 Case 1: frame error
• Receiver sends REJECT
• Receiver discards that frame and all future frames
• Transmitter must go back and retransmit that
frame and all subsequent frames

 Case 2: frame i lost


• If transmitter sends frame i+1 and receiver gets
this frame out of seq, it REJECTS frame i
• If transmitter times out and send ACK with P bit set
which receiver responds to with ACK i
 Transmitter then retransmits frames from i
Error control
o Go-back-N ARQ
 Case 3: frame i received, ACK i+1 lost
• Acks are cumulative, so next ack (i+n) may arrive
before transmitter times out on frame i
• If transmitter times out, it sends ACK with P bit set
• Can be repeated a number of times before a reset
procedure is initiated

 Case 4: REJECT lost


• See lost frame when transmitter times out
Error control
o Selective-reject ARQ
= selective retransmission
 Only rejected frames or those that
time out are retransmitted
 Subsequent frames are accepted
by the receiver and buffered

 Minimizes retransmission
 Receiver must buffer
 More complex logic in transmitter

Example: satellite links


Thank you

Вам также может понравиться