DLL - PowerPoint PPT Presentation

About This Presentation
Title:

DLL

Description:

Overview DLL The concerns at the Data Link Layer include: What services should be provided to upper layers? Framing, Error Control. Flow Control. – PowerPoint PPT presentation

Number of Views:175
Avg rating:3.0/5.0
Slides: 298
Provided by: techs194
Category:
Tags: dll | chapter | method | simplex

less

Transcript and Presenter's Notes

Title: DLL


1
DLL
Overview
  • The concerns at the Data Link Layer include
  • What services should be provided to upper layers?
  • Framing,
  • Error Control.
  • Flow Control.

2
DLL Design
Overview
The goal of the data link layer is to provide
reliable, efficient communication between
adjacent machines connected by a single
communication channel. Specifically 1. Group
the physical layer bit stream into units called
frames. Note that frames are nothing more than
"packets" or "messages". By convention, we'll
use the term "frames" when discussing DLL
packets. 2. Sender checksums the frame and
transmits checksum together with data. The
checksum allows the receiver to determine when a
frame has been damaged in transmit. 3.
Receiver re-computes the checksum and compares it
with the received value. If they differ, an
error has occurred and the frame is
discarded. 4. Perhaps return a positive or
negative acknowledgment to the sender. A
positive acknowledgment indicate the frame was
received without errors, while a negative
acknowledgment indicates the opposite. 5. Flow
control. Prevent a fast sender from overwhelming
a slower receiver. For example, a supercomputer
can easily generate data faster than a PC can
consume it. 6. In general, provide service to
the network layer. The network layer wants to be
able to send packets to its neighbors without
worrying about the details of getting it there
in one piece. At least, the above is what the OSI
reference model suggests. As we will see later,
not everyone agrees that the data link layer
should perform all these tasks.
3
DLL Design Issues
  • Services provided to the N/W layer
  • Framing
  • Error Control
  • Flow Control

4
1.SERVICES PROVIDED TO THE NETWORK LAYER
The main fn of the DLL is to provide services to
the n/w layer The principal service is
transferring data from the n/w layer of 1 m/c to
the n/w layer of another m/c On the src m/c there
is an entity(process) in the n/w layer that
hands some bits to the DLL for txn to the destn
m/c,so they can b handed over to the n/w layer
there.
Virtual
Actual
5
SERVICES PROVIDED TO THE NETWORK LAYER
2 DLL processes communicating using DL protocol
3 services commonly provided are 1.UnAcknowledged
Connection less service 2.Acknowledged
connection less service 3.Acknowledged
connection-oriented service
6
DLL Design
SERVICES PROVIDED TO THE NETWORK LAYER
  • Unacknowledged Connection-less Service -- Best
    Effort
  • The receiver does not return acknowledgments to
    the sender, so the sender has no way of knowing
    if a frame has been successfully delivered.
  • No connection is established beforehand and
    released afterward.
  • If a frame is lost ,no attempt is made to recover
    it in the DLL.
  • This service is appropriate when
  • The error rate is very low ,so recovery is left
    to higher layers
  • For real-time traffic such as speech, in which
    late data is worse than bad.
  • Most LANs use unacknowledged connection less
    service in the DLL

7
DLL Design
SERVICES PROVIDED TO THE NETWORK LAYER
  • Acknowledged Connection-less Service --
    Acknowledged Delivery
  • The receiver returns an acknowledgment frame to
    the sender indicating that a data frame was
    properly received.
  • Still no connection.
  • But each frame sent is individually acknowledged.
  • If it has not arrived within a specified time
    interval, it can b sent again.
  • It is useful for unreliable channels such as
    wireless s/ms.

8
DLL Design
SERVICES PROVIDED TO THE NETWORK LAYER
  • Acknowledged Connection-Oriented Service --
    Reliable Delivery
  • This is the most sophisticated service provided
    by DLL to N/WL.
  • A connection is established first
  • Each frame sent over the connection is numbered.
  • DLL guarantees that each frame sent is rxed,
  • It also guarantees that each frames rxed exactly
    once and that all frames r rxed in the right
    order.
  • Frames are delivered to the receiver reliably and
    in the same order as generated by the sender.

9
SERVICES PROVIDED TO THE NETWORK LAYER
Placement of the data link protocol
EgA WAN subnet consisting of routers connected
by point-to-point leased telephone lines. When a
frame arrives at a router, the h/w verifies the
checksum and passes the frame to the DLL
s/w. This checks to see if this is the frame
expected ,and if packet contained in the
payload field to the routing s/w. The routing s/w
chooses the appropriate outgoing line and passes
the packet back down to the DLL s/w which the
transmits it.
10
DLL Design
SERVICES PROVIDED TO THE NETWORK LAYER
Delivery Mechanisms
11
DLL Design
2.FRAMING
  • To provide service to the n/w layer the DLL
    must use the service given by the Phy.Layer.
  • Function of phy.layer is accept a raw bit stream
    and attempt to deliver it to the destn.
  • This bit stream is not guaranteed to b error
    free.
  • The no. of bits rxed may b less or more than
    that of txed.and they hav different values.
  • So DLL hav to take care of error detection and
    correction.
  • For this purpose ,
  • The DLL translates the physical layer's raw bit
    stream into discrete units (messages) called
    frames and compute the check sum for each frame.
  • When a frame arrives at the destn the checksum is
    recomputed.
  • If the newly computed checksum is diffrnt from
    the one contained in the frame, the DLL knows
    that an error has occurred an takes steps to deal
    with it.

12
Framing Methods
  • Character Count
  • Starting and ending chars. With char stuffing
  • Starting and ending flags with bit stuffing
  • Physical layer coding violations

13
DLL Design
FRAMING
  • 1.Character Count
  • Make the first field in the frame's header be the
    length of the frame (number of characters).
  • When DLL at the rxers end sees the char count it
    knows how many chars follow, and hence where the
    end of the frame is.
  • Disadvantage Receiver loses synchronization
    when bits become garbled. If the bits in the
    count become corrupted during transmission, the
    receiver will think that the frame contains fewer
    (or more) bits than it actually does.
  • Although checksum will detect the frames are
    incorrect, the receiver will have difficulty
    re-synchronizing to the start of a new frame.
    This technique is not used anymore, since better
    techniques are available.

14
A character stream. (a) Without errors. (b)
With one error.
15
DLL Design
FRAMING
2.Character stuffing Use reserved characters
to indicate the start and end of a frame. For
instance, use the two-character sequence DLE STX
(Data-Link Escape, Start of TeXt) to signal the
beginning of a frame, and the sequence DLE ETX
(End of TeXt) to flag the frame's end.
Problem What happens if the two-character
sequence DLE ETX happens to appear in the frame
itself? Solution Use character stuffing
within the frame, insert an ASCII DLE char just
before each occurrence of accidental DLE
character in the data. The receiver reverses the
process, replacing every occurrence of DLE DLE
with a single DLE. Disadvantage it is closely
tied to 8-bit chars in general and the ASCII
char code in particular.
16
Character stuffing
STX
DLE
A
DLE
B
DLE
ETX
a)
Stuffed DLE
STX
DLE
A
DLE
B
DLE
ETX
DLE
b)
STX
DLE
A
DLE
B
DLE
ETX
c)
17
DLL Design
FRAMING
3.Bit Stuffing IDEA Use reserved bit
patterns to indicate the start and end of a
frame. For instance, use the 8-bit sequence of
01111110 ,called flag byte to delimit consecutive
frames. Each frame begins and ends with this
flag byte Problem What happens if the reserved
delimiter happens to appear in the frame itself?
If we don't remove it from the data, the receiver
will think that the incoming frame is actually
two smaller frames! Solution Use bit
stuffing. Whenever the senders DLL encounters
5 consecutive ones in the data ,it automatically
stuffs a 0 bit into the outgoing bit stream.
E.g., if the user data contain the flag pattern
01111110,this flag is transmitted as 011111010
but stored in rxers memory as 01111110.
18
DLL Design
FRAMING
With bit stuffing the boundary betwn 2 frames can
be unambiguously recognized by the flag
pattern. Ie, If the frame loses track of where it
is, all it has to do is scan the i/p for flag
sequences, since they can only occur at frame
boundaries and never with the data. The main
disadvantage with bit stuffing is the insertion
of additional bits into the data stream, wasting
bandwidth.
19
DLL Design
FRAMING
4.Encoding Violations This method is only
applicable to n/ws in which the encoding on
physical medium contains some redundancy. Send a
signal that doesn't conform to any legal bit
representation. In Manchester encoding, for
instance, 1-bits are represented by a high-low
sequence, and 0-bits by low-high sequences. The
start/end of a frame could be represented by the
signal low-low or high-high. The advantage of
encoding violations is that no extra bandwidth is
required as in bit or character stuffing. The
IEEE 802.4 standard uses this approach.
Finally, some systems use a combination of these
techniques. IEEE 802.3, for instance, has both a
length field and special frame start and frame
end patterns.
20
DLL Design
3.ERROR CONTROL
  • Must insure that all frames are eventually
    delivered (possibly in order) to a destination.
  • Three components are required to do this
  •  
  • Acknowledgments, Timers, and Sequence Numbers
  • Acknowledgments
  •  
  • Reliable delivery is achieved using the
    "acknowledgments with retransmission" paradigm.
  • The receiver returns a special acknowledgment
    (ACK) frame to the sender indicating the correct
    receipt of a frame.
  • In some systems, the receiver also returns a
    negative acknowledgment (NACK) for
    incorrectly-received frames.
  • This is only a hint to the sender so that it can
    retransmit a frame right away without waiting for
    a timer to expire.
  •  

21
DLL Design
ERROR CONTROL
  • Timers
  •  
  • One problem that simple ACK/NACK schemes fail to
    address is recovering from a frame that is lost,
    and as a result, fails to solicit an ACK or NACK.
  • What happens if an ACK or NACK becomes lost?
  • Retransmission timers are used to resend frames
    that don't produce an ACK. When sending a frame,
    schedule a timer to expire at some time after the
    ACK should have been returned. If the timer goes
    off, retransmit the frame.
  •  

22
  • Sequence Numbers
  • Retransmissions introduce the possibility of
    duplicate frames.
  • To suppress duplicates, add sequence numbers to
    each frame, so that a receiver can distinguish
    between new frames and repeats of old frames.
  • Bits used for sequence numbers depend on the
    number of frames that can be outstanding at any
    one time.

23
Error Detection Correction
 2 basic strategies for dealing with
errors Error Detecting CodesInclude only
enough redundancy to allow the rxer to identify
an error occurred.   Error Correcting Codes
Include enough redundancy bits along with each
block of data sent to enable the rxer to deduce
what the txed character must hav
been.    Messages (frames) consist of m data
(message) bits and r redundancy bits, yielding an
n ( m r ) bit codeword  
24
  • Given any 2 code words 10001001 and 10111001-it
    is posibl to determine how many corresponding
    bits differ, here it is 2
  • The number of bit positions in which 2 code words
    differ is called HammingDistance
  • Hamming Distance.
  • Given any two codewords, we can determine how
    many of the bits differ. Simply exclusive or
    (XOR) the two words, and count the number of 1
    bits in the result. This count is the Hamming
    Distance
  • Significance If two code words are a HD d apart,
    d single-bit errors are required to convert one
    to the other.

25
  • Eg
  • Error detecting code
  • Parity bit
  • A single parity bit is appended to each data
    block (e.g. each character in ASCII systems) so
    that the number of 1 bits always adds up to an
    even (odd) number
  • A code with 0 parity bit is appended.
  • The parity bit is chosen so that the number of 1
    bits in the codeword is even ( or odd).
  • Eg
  • 10101 can be sent as 101011 with even parity.
  • And 10100 as 101000
  • A code with a single parity bit has a distance
    2.
  • It can b used to detect single bit errors.

26
Error Detection Control
ERROR CORRECTING CODES
Parity Bits   A single parity bit is appended to
each data block (e.g. each character in ASCII
systems) so that the number of 1 bits always adds
up to an even (odd) number.   1000000(1)
1111101(0)   It cannot correct even single-bit
errors (but can detect single-bit errors).
27
Hamming Codes
  • Hamming codes correct all single bit errors with
    only log(M) extra bits and detect double bit
    errors
  • Uses an interleaved parity scheme

28
Calculating a Hamming Code
  • Procedure
  • Place message bits in their non-power-of-two
    Hamming positions
  • Build a table listing the binary representation
    each of the message bit positions
  • Calculate the check bits

29
  • Number of parity bits
  • If the no. of infrmn bits is m,then the no. of
    parity bit p is determined by
  • 2pgtmp1
  • Eg
  • If we hav 4 infrmn bits then p is found by trial
    and error method using the above eqn.
  • Let p2 then 2p224, 4gt421-not satisfied
  • Let p3 then 2p238, 8gt7- condition satisfied.

30
  • Placement of parity bit in the code
  • For a 4 bit infrmn, a 3 bit parity is also
    needed. In total 437 bits
  • The parity bits are located in the position that
    are numbered corresponding to ascending power of
    2(1,2,4,8..)
  • bit1 bit2 bit3 bit4 bit5 bit6 bit7
  • 001 010 011 100 101 110 111
  • P1 P2 M1 P3 M2 M3 M4

31
Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
Position
3 check bits
32
Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1 0 1 1 1 2 3 4 5 6
7 20 21 22 00 1 0 1 0 011 100
101 110 111
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
33
Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22 00 1 0 1 0 011 100
101 110 111
1
Starting with the 20 position Look at positions
with 1s in them Count the number of 1s in
the corresponding message bits If even, place a
1 in the 20 check bit, i.e., use odd
parity Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
34
Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1 0 1 1 1 2 3 4 5 6
7 20 21 22 00 1 0 1 0 011 100
101 110 111
1
0
Repeat with the 21 position Look at positions
those positions with 1s in them Count the
number of 1s in the corresponding message
bits If even, place a 1 in the 21 check
bit Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
35
Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1 0 1 1 1 2 3 4 5 6
7 20 21 22 00 1 0 1 0 011 100
101 110 111
1
0
1
Repeat with the 22 position Look at positions
those positions with 1s in them Count the
number of 1s in the corresponding message
bits If even, place a 1 in the 22 check
bit Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
36
Hamming Code Example
  • Original message 1011
  • Sent message 1011011
  • Now, how do we check for a single-bit error in
    the sent message using the Hamming code?

37
Using Hamming Codes to Correct Single-Bit Errors
Sent message
1 0 1 1 0 1 1
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
38
Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Starting with the 20 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 20
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Odd parity No error in bits 1, 3, 5, 7
39
Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Repeat with the 21 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 21
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Even parity ERROR in bit 2, 3, 6 or 7!
40
Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Repeat with the 22 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 22
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Even parity ERROR in bit 4, 5, 6 or 7!
41
Hamming Codes
  • Hamming codes can be used to locate and correct a
    single-bit error
  • If more than one bit is in error, then a Hamming
    code cannot correct it
  • Hamming codes, like parity bits, are only useful
    on short messages

42
  • 1)No Error 0
  • 2)Error 1
  • 3)Error 1

So error is at he 6 th position.
43
CRC Polynomial Codes
  • Can detect errors on large chunks of data
  • Has low overhead
  • More robust than parity bit
  • Requires the use of a code polynomial
  • Example x2 1
  • The sender and rexr must agree upon a code
    polynomial G(x).

44
  • Idea is
  • To append a checksum to the end of the frame in
    which a way that the polynomial represented by
    the check summed frame is divisible by G(x).
  • When the rxer gets the check summed frame it
    tries dividing it by G(x).
  • If there is a reminder there is a txn error.

45
Cyclic Redundancy Check
  • Procedure
  • 1. Let r be the degree of the code polynomial.
    Append r zero bits to the end of the transmitted
    bit string. Call the entire bit string S(x)
  • 2. Divide S(x) by the code polynomial G(x) using
    modulo 2 division.
  • 3. Subtract the remainder from S(x) using modulo
    2 subtraction.
  • The result is the check summed message T(x)

46
Generating a CRCExample
Message 1011 1 x x3 0 x x2 1 x x 1
x3 x 1 Code Polynomial x2 1
(101)
Step 1 Compute S(x) r 2 S(x) 101100
47
Generating a CRCExample (contd)
Step 2 Modulo 2 divide
Remainder
48
Generating a CRCExample (contd)
Step 3 Modulo 2 subtract the remainder from S(x)
101100
- 01
101101
Check summed Message T(x)
49
Decoding a CRC
  • Procedure
  • 1. Divide the check summed message by the code
    polynomial using modulo 2 division. If the
    remainder is zero, there is no error detected.

50
Decoding a CRCExample
101101
Checksummed message T(x) (n 6)
1011
Original message (if there are
no errors)
Remainder 0 (No error detected)
51
Decoding a CRCAnother Example
  • When a bit error occurs, there is a large
    probability that it will produce a polynomial
    that is not an even multiple of the code
    polynomial, and thus errors can usually be
    detected.

Remainder 1 (Error detected)
52
Choosing a CRC polynomial
  • The longer the polynomial, the smaller the
    probability of undetected error
  • Common standard polynomials
  • (1) CRC-12 x12 x11 x3 x2 x1 1
  • (2) CRC-16 x16 x15 x2 1
  • (3) CRC-CCITT x16 x12 x5 1

53
ELEMENTARY DLL PROTOCOLS
54
   ELEMENTARY DATA LINK PROTOCOLS   The DLL
provides these services to the Network Layer
above it   Data handed to a DLL by a Network
Layer on one module, are handed to the Network
Layer on another module by that DLL.   The remote
Network Layer peer should receive the identical
message generated by the sender (e.g., if the
data link layer adds control information, the
header information must be removed before the
message is passed to the Network Layer).  
55
  • The Network Layer may want to be sure that all
    messages it sends, will be delivered correctly
    (e.g., none lost, no corruption). Note that
    arbitrary errors may result in the loss of both
    data and control frames.
  •  
  • The Network Layer may want messages to be
    delivered to the remote peer in the exact same
    order as they are sent.
  • Note It is not always clear that we really want
    our data link layer protocol to provide this type
    of service.
  •  
  • Nonetheless, the ISO reference model suggests
    that the data link layer provide such a service,
    and we now examine the protocols that do so.

56
DLL Protocols
 THE METHOD WE WILL USE   Look at successive
data link protocols of increasing complexity to
provide reliable, in order, message delivery to
the network layer.   Environment   Assume
DLL executes as a process (schedulable entity)
with routines to communicate with the Network
Layer above and the Physical Layer below.  
57
  • Frames are the unit of transmission. Consists of
    data plus control bits (header information).
  •  
  • Of special interest is typedef struct
    frame
  • void wait_for_event( event_type event )
  •  
  • wait_for_event() suspends the process until an
    event occurs. Possible events include requests
    from the network layer, the physical layer and
    the timer.

58
DLL Protocols
BUILDING BLOCKS
define MAX PKT 1024
/ determines packet size in bytes / typedef
enum false, true boolean / boolean
type / typedef unsigned int seq_nr /
sequence or ack numbers / typedef struct
unsigned char dataMAX PKT packet /
packet definition / typedef enum data, ack,
nak frame_kind / frame kind definition /
  • typedef struct / frames are transported in
    this layer /
  • frame_kind kind / what kind of a frame is
    it? /
  • seq_nr seq / sequence number /
  • seq_nr ack / acknowledgement number /
  • packet info / the network layer packet /
  • frame

59
DLL Protocols
BUILDING BLOCKS
/ 1. Wait for an event to happen return its
type in event. / void wait_for_event(event_type
event ) / 2. Fetch a packet from the network
layer for transmission on the channel. / void
from_network_layer( packet p) / 3. Deliver
information from an inbound frame to the network
layer. / void to_network_layer( packet p) /
4. Go get an inbound frame from the physical
layer and copy it to r. / void
from_physical_layer( packet p) / 5. Pass the
frame to the physical layer for transmission.
/ void to_physical_layer( packet p) / 6.
Start the clock running and enable the timeout
event. / void start_timer(seq_nr k)
60
BUILDING BLOCKS
  • / 7. Stop the clock and disable the timeout
    event. /
  • void stop_timer(seq_nr k)
  • / 8. Start an auxiliary timer and enable the
    ack_timeout event. /
  • void start_ack_timer(void)
  • / 9. Stop the auxiliary timerand disable the
    ack_timeout event. /
  • void stop_ack_timer(void)
  • / 10. Allow the network layer to cause a
    network_layer_event. /
  • void enable_network_layer( void )
  • / 11. Forbid the network layer from causing a
    network_layer_event. /
  • void disable_network_layer( void )
  • These definitions r located in the file
    protocol.h

61
DLL Protocols
1.AN UNRESTRICTED SIMPLEX PROTOCOL
    Assumptions   Data transmission in one
direction only (simplex).   No errors take place
on the physical channel.   The sender/receiver
can generate/consume an infinite amount of
data.   Always ready for sending/receiving.    
62
DLL Protocols
AN UNRESTRICTED SIMPLEX PROTOCOL
/ Protocol 1 (utopia) provides for data
transmission in one direction only, from sender
to receiver. The communication channel is assumed
to be error free and the receiver is assumed to
be able to process all the input infinitely fast.
Consequently, the sender just sits in a loop
pumping data out onto the line as fast as it can.
/ typedef enum frame_arrival
event_type include "protocol.h" void
sender1(void) frame s / buffer for an
outbound frame / packet buffer / buffer
for an outbound packet / while (true)
from_network_layer(buffer) / go get
something to send / s.info buffer / copy
it into s for transmission / to_physical_layer(
s) / send it on its way /
63
AN UNRESTRICTED SIMPLEX PROTOCOL
DLL Protocols
void receiver1(void) frame r event_type
event / filled in by wait, but not used here
/ while (true) wait_for_event(event) /
only possibility is frame arrival
/ From_physical_layer(r) / go get the
inbound frame / To_network_layer(r.info) /
pass the data to the network layer /
64
DLL Protocols
2.SIMPLEX STOP-AND-WAIT PROTOCOL
  Assumptions   No longer assume receiver can
process incoming data infinitely fast.   Sender
ships one frame and then waits for acknowledgment
(stop and wait.)   The contents of the
acknowledgment frame are unimportant.   Data
transmission is one directional, but must have
bi-directional line. Could have a half-duplex
(one direction at a time) physical channel.  
65
DLL Protocols
SIMPLEX STOP-AND-WAIT PROTOCOL
/ Protocol 2 (stop-and-wait) also provides for a
one-directional flow of data from sender to
receiver. The communication channel is once again
assumed to be error free, as in protocol 1.
However, this time, the receiver has only a
finite buffer capacity and a finite processing
speed, so the protocol must explicitly
prevent the sender from flooding the receiver
with data faster than it can be handled.
/ typedef enum frame_arrival
event_type include "protocol.h" void
sender2(void) frame s / buffer for an
outbound frame / packet buffer / buffer
for an outbound packet / event_type event
/ frame_arrival is the only possibility
/ while (true) from_network_layer(buffer)
/ go get something to send / s.info
buffer / copy it into s for transmission
/ to_physical_layer(s) / send it on its
way / wait_for_event(event) / do not
proceed until given the go ahead /
66
DLL Protocols
void receiver2(void) frame r, s event_type
event / filled in by wait, but not used here
/ while (true) wait_for_event(event) /
only possibility is frame arrival
/ From_physical_layer(r) / go get the
inbound frame / To_network_layer(r.info) /
pass the data to the network layer
/ to_physical_layer(s) / send a dummy
frame to awaken sender /
67
DLL Protocols
3.SIMPLEX PROTOCOL FOR A NOISY CHANNEL
  •  
  • Assumptions
  •  
  • The channel is noisy and we can lose frames (they
    never arrive).
  •  
  • Simple approach, add a time-out to the sender so
    if no ACK after a certain period, it retransmits
    the frame.
  •  
  • Scenario of a bug that could happen if were not
    careful
  •  
  • A transmits frame one
  • B receives A1
  • B generates ACK
  • ACK is lost
  • A times out, retransmits
  • B gets duplicate copy of A1 (and sends it on to
    network layer.)
  •  

68
  • Use a sequence number.
  • 1-bit is sufficient for this simple case because
    only concerned about two successive frames(m and
    m1)
  • A ve Ack retxn Protocol
  • Positive Acknowledgment with Retransmission
    (PAR)
  • Or ARQ(Automatic Repeat Request)
  • Sender waits for positive acknowledgment before
    advancing to the next data item.
  • This one also transmits data only in 1 direction.
  • It can handle lost frames-it requires the time
    out interval to b long enough to prevent
    premature timeouts.
  • If the sender time outs too early ,while the ack
    is still on the way it will send a duplicate .

69
  • When the prev ack finally does arrive ,the sender
    will mistakenly think that the just-sent frame is
    the one being acknowledged and will not realize
    that there is another ack frame somewhere in the
    pipe.
  • If the next frame sent is lost completely but the
    xtra ack arrives correctly, the sender wont
    attempt to retransmit the lost fame ,and the
    protocol will fail.
  • Protocol 3 differs from its predecessors in that
    both sender and rxer hav a variable whose value
    is remembered while the DLL is in wait state.
  • The sender remembers the seq number of the next
    frame to send in next_frame_to_send and rxer
    remembers the seq number of the next frame
    expected in frame_expected.

70
  • After txing the frame and starting the timer ,the
    sender waits for
  • an ack frame arrives undamaged, a damaged ack or
    timer goes off
  • If a valid ack comes in,the sender fetches the
    next packet from its n/w layer and puts it in the
    buffer and advances the seq number.
  • If damaged or no ack frame arrives neither the
    buffer nor he seq number is changed,so that a
    duplictae can b sent.

71
DLL Protocols
3.SIMPLEX PROTOCOL FOR A NOISY CHANNEL
/ Protocol 3 (par) allows unidirectional data
flow over an unreliable channel. / define
MAX_SEQ 1 / must be 1 for protocol 3
/ typedef enum frame_arrival, cksum_err,
timeout event_type include "protocol.h void
sender3(void) seq_nr next_frame_to_send /
Seq number of next outgoing frame / frame s
/ buffer for an outbound frame / packet
buffer / buffer for an outbound packet
/ event_type event / frame_arrival is the
only possibility / next_frame_to_send
0 from_network_layer(buffer) / go get
something to send /
72
  • while (true)
  • s.info buffer / copy it into s for
    transmission /
  • s.seq next_frame_to_send/ insert
    sequence number in frame /
  • to_physical_layer(s) / send it on its way
    /
  • start_timer( s.seq) / if answer takes too
    long, time out /
  • wait_for_event(event) / frame arrival or
    cksum err, or timeout /
  • if ( event frame_arrival)
  • from_physical_layers(s) / Get the ACK /
  • if ( s.ack next_frame_to_send )
  • from_network_layer( buffer ) / get the
    next one to send /
  • inc( next_frame_to_send ) / invert
    next_frame_to_send /

73
DLL Protocols
SIMPLEX PROTOCOL FOR A NOISY CHANNEL
void receiver3(void) seq_nr frame_expected fr
ame r, s event_type event while (true)
wait_for_event(event) / only possibility
is frame arrival / if ( frame
event_arrival ) / A valid frame has arrived
/ from_physical_layer(r) / go get the
inbound frame / if ( r.seq frame_expected
) / This is what weve been waiting for /
to_network_layer(r.info) / pass the data
to the network layer /
inc(frame_expected) / next time expect the
other seq / to_physical_layer(s)
/ send a dummy frame to awaken sender /

74
DLL Protocols
SIMPLEX PROTOCOL FOR A NOISY CHANNEL
   A Problem unresolved by this protocol is
this   How long should the timer be?   What if
too long? (inefficient)   What if too short?    
75
Sliding Window Protocols
FEATURES
  •    
  • Use more realistic Two-way communication.
  •  
  • We now have two kinds of frames (containing a
    "kind" field)
  •  
  • Data
  • ACK containing (sequence number of last correctly
    received frame).
  •  
  • Piggybacking the technique of temporarily
    delaying outgoing ack so that they can b
    attached on to the next outgoing data frame.
  •  
  • Piggybacking issue For better use of bandwidth,
    how long should we wait for outgoing data frame
    before sending the ACK on its own.

76
  • Next 3 protocols r more robust and continue to
    function even under pathological conditions.
  • All 3 belongs to a class of protocols called
    Sliding window protocol.
  • 3 differ among themselves in terms of
    efficiency,complexity,and buffer requirements.

77
Sliding Window Protocols
  • A One-Bit Sliding Window Protocol
  • A Protocol Using Go Back N
  • A Protocol Using Selective Repeat

78
  • In SWP each outbound frame contains a seq no.
    ranging frm 0 to some max.
  • Max is usually 2n-1 so the seq no. fits in an
    n-bit field.
  • Basic Idea
  • At any instant of time the sender maintains a set
    of sequence numbers corresponding to frames it is
    permitted to send.
  • This frames r said to b in sending window
  • Rxer also maintains a rxing window corresponding
    to the set of frames it is permitted to accept.
  • Both hav the same lower and upper limits,or hav
    the same size.

79
  • The seq. nos within the senders window represent
    frames sent but as yet not acknowledged.
  • Whenever a new packet arrives from the n/w layer
    it is given the next highest seq.no,and the upper
    edge of the window is advanced by one.
  • When an ack comes in ,the lower edge is advanced
    by one.
  • In this way the window continuously maintains a
    list of un acknowledge frames.

80
Sliding Window Protocols
  • A sliding window of size 1, with a 3-bit sequence
    number.
  • (a) Initially.
  • (b) After the first frame has been sent.
  • (c) After the first frame has been received.
  • (d) After the first acknowledgement has been
    received.

81
  • If the max window size is n, the sender needs n
    buffers to hold the un acknowledged frame.
  • The rxing dlls window corresponds to the the
    frames it may accept .
  • Any frame falling outside the window is
    discarded.
  • When a frame whose seq number is equal to the
    lower edge of the window is rxed,it is passed to
    the n/w layer, an ack is generated and the window
    is rotated by one.
  • Window size 1 means that the DLL accepts frames
    in order-for larger window size this is not so.

82
1.One Bit SWP
  • Here window size is 1
  • Sequence number is of 1 bit (ie,0 or 1)
  • Use stop-and-wait sender transmits a frame and
    waits for its ACK before sending the next one

83
A One-Bit Sliding Window Protocol
Continued ?
84
A One-Bit Sliding Window Protocol (ctd.)
85
  • Two scenarios for protocol 4. (a) Normal case.
    (b) Abnormal case. The notation is (seq, ack,
    packet number). An asterisk indicates where a
    network layer accepts a packet.

86
Sliding Window Protocols
OTHER ISSUES
  Problem with stop and wait protocols is that
sender can only have one unACKed frame
outstanding.   This is a consequence of the rule
requiring a sender to wait for an acknowledgement
bfor sending another frame. If this restriction
is relaxed, better efficiency can b
achieved. Ie, allowing the sender to transmit up
to w frames before blocking, instead of 1. With
an appropriate choice of w the sender will b able
to continuously transmit frames for a time
interval equal to the round-trip transit time
without filling up the window. This is known as
pipelining.
87
  • If the channel capacity is b bits/sec, the frame
    size is l bits, and the round-trip propagation
    delay is R sec, the time required to transmit a
    single frame is l/b.
  • So R/2 is the delay before that bit arrives at
    the rxer.
  • And another R/2-to get the ack back.
  • So in total R-round-trip propagation delay.
  • Since there is always a non zero delay for the
    ack to propagate back ,in principle pipelining
    can b used to keep the line busy during this
    interval.

88
Sliding Window Protocols
PIPELINING
 Problems with pipelining Sender does not wait
for each frame to be ACK'ed. Rather it sends many
frames with the assumption that they will
arrive. Must still get back ACKs for each frame.
  Provides more efficient use of transmit
bandwidth, but error handling is more complex.
  What if 20 frames transmitted, and the second
has an error. Frames 3-20 will be ignored at
receiver side? Sender will have to retransmit.
What are the possibilities?  
89
SLIDING WINDOW MECHANISMS
Two basic approaches to deal with errors in the
presence of pipelining.
2.Go back n - If receiver sees bad frames or
missing sequence numbers, subsequent frames are
discarded. No ACKs for discarded
frames. Equivalent to receiver's window size of
one. The DLL refuses to accept any frame except
the next one it must give to the n/w layer. If
the senders widow fills up before the timer runs
out, the pipeline will begin to
empty. Eventually, the sender will time out and
retransmit all unacknowledged frames in order,
starting with the damaged or lost one. Dis advtg
waste much of the b/w if the error rate is high
90
Sliding Window Protocols
SLIDING WINDOW MECHANISMS
 3.Selective repeat the rxing DLL hav to store
all the correct frames following the bad
ones. When the sender finally notices that
something is wrong ,it just retransmits the one
bad frame, not all its successors,. If the second
try succeeds, the rxing DLL will now hav many
correct frames in sequence ,so they can all b
handed off to the n/w layer quickly, and the
highest number acknowledged.
91
Protocol Specification Verification
92
Protocol Specification Verification
Deals with techniques for specifying and
verifying protocols We r using 2
techniques 1.Finite State Machine model 2.Petri
Net model 
93
1.Finite State M/c models
  • Each protocol machine (sender/ rxer) is always in
    a specific state at every instant of time.
  • Eg The rxer in protocol 3 2 important states
    are waiting for frame0 or waiting for frmae1.
  • Typically the states r chosen to b those instants
    that the protocol m/c is waiting for the next
    event to happen (eg wait (event)).
  • The state of the complete s/m is the combination
    of the 2 protocol m/cs and the channel.
  • The state of the channel is represented by its
    contents.
  • Using protocol 3 the channel has 4 possible
    states
  • A 0 frame or 1 frame moving from sender to rxer,
    an ack going the other way, or an empty channel.

94
  • From each state there r 0 or more possible
    transitions to other states.
  • Transitions occur when some event happens
  • In a protocol m/c transitions occur when a frame
    is sent, when a frame arrives, when a timer goes
    off etc.
  • One particular state is designated as initial
    state-corresponds to the description of the s/m
    when it starts running.
  • From the initial state some or all of the other
    states can b reached by a sequence of
    transitions.
  • Using some well-known techniques from graph
    theory, it is possible to determine which states
    r reachable and which r not.
  • This technique is called reachability analysis.
  • This can b helpful in determining if a protocol
    is correct or not.

95
  • Formally, a finite state m/c can b regarded as a
    quadruple (S,M,I,T) where
  • S is the set of states the processes and
    channels can b in
  • M is the set of frames that can b exchanged over
    the channel
  • I is the set of initial states of the processes.
  • T is the set of transitions betwn states.
  • At the beginning of time ,all processes r in
    their initial states.
  • Then events begin to happen-like frames becoming
    available for txn or timers going off.
  • Each event may cause on of the processes or the
    channel to take an action and switch to a new
    state.
  • Eg Finite state m/c model of protocol 3

96
  • Each protocol m/c has 2 states and channel has 4
    states- a total of 16 states exist, not all of
    them reachable from the initial one.
  • Each state is labeled by 3 chars-X, Y and Z
  • Where X is 0/1 corresponding to the frame the
    sender is trying to send
  • Y is 0/1 corresponding to the frame the rxer
    expects,
  • Z is 0,1 or A or empty(-) corresponding to the
    state of the channel.
  • Above eg. Initial state is chosen as (000)
  • Ie, the sender has just sent frame 0,the rxer
    expects frame 0 and frame 0 is currently on
    channel.
  • Total 9 transitions r shown.
  • Transition 0 consists of the channel losing its
    contents.
  • Transition 1 consists of the channel correctly
    delivering packet 0 to the rxer, with the rxer
    then changing its state to expect frame 1 and
    emitting an ACK
  • Transition 1 also corresponds to the rxer
    delivering packet 0 to the n/w layer.

97
Eg Protocol 3
  • (a) State diagram for protocol 3. (b)Transitions.

98
  • During normal operation, transition 1,2,3 and 4
    r repeated in order over and over.
  • In each cycles,2 packets r delivered, bringing
    the sender back to the initial state of trying to
    send a new frame with seq no. 0.
  • If the channel loses frame 0,it makes a
    transition from state (000) to (00-).
  • Eventually the sender times out (transition 7)
    and the s/m moves back to (000).
  • The loss of ack requires 2 transitions 7 and 5
    or 8 and 6 to repair the damage.

99
2.Petri Net Models
  • Has 4 basic elements- places, transitions, arcs
    and tokens.
  • Places represents a state in the system may b
    in.
  • Fig shows a petri net model with 2 places A and B
    both shown as circles.
  • The s/m is currently in state A ,indicated by the
    token (heavy dot) in place A.
  • A transition is indicated by horizontal or
    vertical bar.
  • Each transition has 0 or more input arcs, coming
    from its input places and 0 or more output arcs,
    going to its output places

100
  • A transition is enabled if there is at least 1
    i/p token in each of its input places.
  • Any enabled transition may fire at will, removing
    1 token from each i/p place and depositing a
    token in each o/p place.
  • If 2 or more transitions r enabled any one of
    them may fire.
  • The choice of a transition to fire is
    indeterminate, which is y Petri nets r useful for
    protocol modeling

101
  • A Petri net model for protocol 3.

102
  • From fig, there r no composite states here the
    senders state, channel state, and rxers state r
    represented separately.
  • Transition 1 transmission of frame 0 by the
    sender normally.
  • Transition 2 1transmission of frame 0 on a
    Time out.
  • Transition 3 and Transition 4 for frame 1
  • Transition 5,6 and 7 correspond to the loss of
    frame 0,an ACK and frame 1 respectively.
  • Transition 8 9 occurs when a data frame with
    wrong seq no arrives at the rxer.
  • Transitions 10 11 represent the arrival at the
    rxer of the next frame in sequence and its
    delivery to the n/w layer

103
Example Data Link Protocols
104
Examples
HDLC
 HDLC - HIGH LEVEL DATA LINK CONTROL   CCITT
Adopted HDLC for its LAP (Link Access Procedure)
as part of the X.25 network interface std, but
later modified it to LAPB to make it more
compatible with the later version of HDLC   A
connection oriented 64Kbps network using either
virtual or permanent circuits.   This protocol is
Bit oriented (uses bit stuffing and bit
delimiters).
Frame structure of all bit oriented protocols
105
  • Address used to identify different terminals
  • Controlfield is used for seq numbers,acks etc.
  • Data contain arbitrary infrmn.
  • Checksum field si a minor variation on the well
    known CRC-CCITT as the generator polynomial.
  • The minimum frame contains 3 fields and total
    32 bits excluding the flags on either end.

106
3 kinds of frames Information, Supervisory, and
Unnumbered. Control fields of these 3 r given
The protocol uses a sliding window ,with a 3 bit
seq number. Up to 7 un acknowledged frames may b
outstanding at any instant. Seq sequence
number Nextpiggy backed ack P/FPoll/Finalis
used when a computer is polling a group of
terminals. When used as P the computer is
inviting the terminal to send data. All the
frame sent by the terminal except the final one
hav the P/F bit as P.the final one is set to F.
107
  • Type used to distinguish various types of
    supervisory frames.
  • Type 0 is an ACK frame (RECEIVE READY) used to
    indicate the next frame expected.
  • Type 1is a NACK frame (REJECT) used to indicate
    that a txn error has been detected.
  • The Next field indicates the first frame in
    sequence not rxed correctly.
  • The sender is required to retransmit all
    outstanding frames starting at next.
  • Type 2 is RECEIVE NOT READY .It acknowledges all
    frames up to but not including Next but it tells
    the the sender to stop sending.
  • Type 3 is the SELECTIVE REJECT.it calls for
    retxn of only the frame specified.
  • Unnumbered frames are used for control purposes
    but can also b used to carry data when un
    reliable connectionless service is called for.

108
Examples
DLL In The Internet
  •   
  • 2 such protocols widely used in the internet r
    SLIP and PPP.
  • 1.SLIP-Serial Line IP
  • SLIP-older one
  • Devised by Rick Adams in 1984 to connect sun
    workstations to the Internet over a dial-up line
    using a modem.
  • The work station just sends raw IP packets over
    the line, with a special flag byte (0xC0) at the
    end for framing.
  • If the flag byte occurs inside the IP packet a
    form of char. Stuffing is used and 2 byte
    sequence(0xDB,0xDC) is sent in its place.
  • More recent versions of SLIP do some TCP and IP
    header compression.
  • It is still widely used but has some serious
    problems
  • It does not do any error detection or correction
  • It supports only IP
  • Each side must know others IP in advance
  • Doe not provide any form of authentication
  • Not an approved internet standard.

109
  •   
  • 2.PPP-Point to Point Protocols
  • To improve the above situation IETF
    (InternetEnggTaskForce) set up a group to device
    a DL protocol for point-point lines that solved
    all these problems and became an official std.
  • PPP handles
  • Error detection,Supprots multiple
    protocols,allows IP addresses to b negotiated at
    connection time, permits authentication, etc.
  • PPP provides 3 things
  • 1)A framing method that unambiguously delineates
    the end of the frame and the start of the next
    one.
  • 2)A link protocol for bringing lines up, testing
    them, negotiating options, and bringing them down
    when they r no longer needed. called LCP-Link
    Control Protocol
  • 3)A way to negotiate network-layer options in a
    way that is independent of the n/w layer protocol
    to b used- ie,Different NCP (Network Control
    Protocol)

110
Working of PPP
  • Consider the case of a home user calling up an
    ISP to make a home PC a temp internet host.
  • PC first calls the ISPs router via a modem.
  • After getting answer from modem establish a
    physical connection thru the phone.
  • The PC sends the router a series of LCP packets
    in the pay load field of one or more PPP frames.
  • These packets and their responses ,select the PPP
    parameters to b used.
  • After agreeing this a series of NCP packets r
    sent to configure the n/w layer.
  • The PC wants to run a TCP/IP protocol stack and
    need an IP address.
  • There r not enough IP addresses to go around-
    normally each ISP gets a block of them and then
    dynamically assigns 1 to each newly attached PC
    for the duration of its login session.

111
  • The NCP for IP used to do the IP adrs assignment.
  • The PC is now an Internet host and can send and
    receive IP packets.
  • When the user is finished ,NCP is used to tear
    down the n/w layer connection and free up the IP
    adrs.
  • Then LCP is used to shutdown the DLL connection.
  • Finally computer tells the modem to hang up the
    phone ,releasing the phy.layer connection.

112
The Data Link Layer in the Internet
  • A home personal computer acting as an internet
    host.

113
PPP full frame format for unnumbered mode
operation
Address always set to 11111111 to indicate that
all stations r to accept the frame. Control000000
11 indicates an unnumbered frame.(as default PPP
does not provide reliable txn using seq numbers
and ack) Protocol job is to tell what kind of
packet is in the payload field. Codes r defined
for LCP,NCP, IP,IPX etc. Protocols starting with
a 0 bit r n/w layer protocols such as IP,IPX
etc Starting with 1 bit r used to negotiate other
protocols (like LCP,NCP etc). Payload field is
variable length up to some max (Default is 1500
bytes) Checksum normally 2 bytes but 4 bytes can
b negotiated
114
In summary ,PPP is a multiprotocol framing
mechanism suitable for use over modems, HDLC
bit-serial lines, SONET and other physical
layers. It supports error detection, header
compression etc
  • A simplified phase diagram for bring a line up
    and down.

115
Examples
DLL in ATM
116
2.8 Error Detection and Correction
  • It is physically impossible for any data
    recording or transmission medium to be 100
    perfect 100 of the time over its entire expected
    useful life.
  • As more bits are packed onto a square centimeter
    of disk storage, as communications transmission
    speeds increase, the likelihood of error
    increases-- sometimes geometrically.
  • Thus, error detection and correction is critical
    to accurate data transmission, storage and
    retrieval.

117
2.8 Error Detection and Correction
  • Check digits, appended to the end of a long
    number can provide some protection against data
    input errors.
  • The last character of UPC barcodes and ISBNs are
    check digits.
  • Longer data streams require more economical and
    sophisticated error detection mechanisms.
  • Cyclic redundancy checking (CRC) codes provide
    error detection for large blocks of data.

118
2.8 Error Detection and Correction
  • Checksums and CRCs are examples of systematic
    error detection.
  • In systematic error detection a group of error
    control bits is appended to the end of the block
    of transmitted data.
  • This group of bits is called a syndrome.
  • CRCs are polynomials over the modulo 2 arithmetic
    field.

The mathematical theory behind modulo 2
polynomials is beyond our scope. However, we can
easily work with it without knowing its
theoretical underpinnings.
119
2.8 Error Detection and Correction
  • Modulo 2 arithmetic works like clock arithmetic.
  • In clock arithmetic, if we add 2 hours to 1100,
    we get 100.
  • In modulo 2 arithmetic if we add 1 to 1, we get
    0. The addition rules couldnt be simpler

0 0 0 0 1 1 1 0 1 1 1 0
You will fully understand why modulo 2
arithmetic is so handy after you study digital
circuits in Chapter 3.
120
2.8 Error Detection and Correction
  • Find the quotient and remainder when 1111101 is
    divided by 1101 in modulo 2 arithmetic.
  • As with traditional division, we note that the
    dividend is divisible once by the divisor.
  • We place the divisor under the dividend and
    perform modulo 2 subtraction.

121
2.8 Error Detection and Correction
  • Find the quotient and remainder when 1111101 is
    divided by 1101 in modulo 2 arithmetic
  • Now we bring down the next bit of the dividend.
  • We see that 00101 is not divisible by 1101. So we
    place a zero in the quotient.

122
2.8 Error Detection and Correction
  • Find the quotient and remainder when 1111101 is
    divided by 1101 in modulo 2 arithmetic
  • 1010 is divisible by 1101 in modulo 2.
  • We perform the modulo 2 subtraction.

123
2.8 Error Detection and Correction
  • Find the quotient and remainder when 1111101 is
    divided by 1101 in modulo 2 arithmetic
  • We find the quotient is 1011, and the remainder
    is 0010.
  • This procedure is very useful to us in
    calculating CRC syndromes.

Note The divisor in this example corresponds
to a modulo 2 polynomial X 3 X 2 1.
124
2.8 Error Detection and Correction
  • Suppose we want to transmit the information
    string 1111101.
  • The receiver and sender decide to use the
    (arbitrary) polynomial pattern, 1101.
  • The information string is shifted left by one
    position less than the number of positions in the
    divisor.
  • The remainder is found through modulo 2 division
    (at right) and added to the information string
    1111101000 111 1111101111.

125
2.8 Error Detection and Correction
  • If no bits are lost or corrupted, dividing the
    received information string by the agreed upon
    pattern will give a remainder of zero.
  • We see this is so in the calculation at the
    right.
  • Real applications use longer polynomials to cover
    larger information strings.
  • Some of the standard poly-nomials are listed in
    the text.

126
2.8 Error Detection and Correction
  • Data transmission errors are easy to fix once an
    error is detected.
  • Just ask the sender to transmit the data again.
  • In computer memory and data storage, however,
    this cannot be done.
  • Too often the only copy of something important is
    in memory or on disk.
  • Thus, to provide data integrity over the long
    term, error correcting codes are required.

127
2.8 Error Detection and Correction
  • Hamming codes and Reed-Soloman codes are two
    important error correcting codes.
  • Reed-Soloman codes are particularly useful in
    correcting burst errors that occur when a series
    of adjacent bits are damaged.
  • Because CD-ROMs are easily scratched, they employ
    a type of Reed-Soloman error correction.
  • Because the mathematics of Hamming codes is much
    simpler than Reed-Soloman, we discuss Hamming
    codes in detail.

128
2.8 Error Detection and Correction
  • Hamming codes are code words formed by adding
    redundant check bits, or parity bits, to a data
    word.
  • The Hamming distance between two code words is
    the number of bits in which two code words
    differ.
  • The minimum Hamming distance for a code is the
    smallest Hamming distance between all pairs of
    words in the code.

This pair of bytes has a Hamming distance of 3
129
2.8 Error Detection and Correction
  • The minimum Hamming distance for a code, D(min),
    determines its error detecting and error
    correcting capability.
  • For any code word, X, to be interpreted as a
    different valid code word, Y, at least D(min)
    single-bit errors must occur in X.
  • Thus, to detect k (or fewer) single-bit errors,
    the code must have a Hamming distance of
    D(min) k 1.

130
2.8 Error Detection and Correction
  • Hamming codes can detect D(min) - 1 errors and
    correct errors
  • Thus, a Hamming distance of 2k 1 is required to
    be able to correct k errors in any data word.
  • Hamming distance is provided by adding a suitable
    number of parity bits to a data word.

131
2.8 Error Detection and Correction
  • Suppose we have a set of n-bit code words
    consisting of m data bits and r (redundant)
    parity bits.
  • An error could occur in any of the n bits, so
    each code word can be associated with n erroneous
    words at a Hamming distance of 1.
  • Therefore,we have n 1 bit patterns for each
    code word one valid code word, and n erroneous
    words.

132
2.8 Error Detection and Correction
  • With n-bit code words, we h
Write a Comment
User Comments (0)
About PowerShow.com