Computerr Network UNIT2
Computerr Network UNIT2
Computerr Network UNIT2
A burst error means that 2 or more bits in the data unit have changed.
Error Detection and Correction
Detection
Error detection uses the concept of redundancy, which means adding extra
bits for detecting errors at the destination.
• Redundancy
• Parity Check
• Checksum
Error Detection and Correction
Redundancy
Error Detection and Correction
Detection methods
Error Detection and Correction
Even-parity concept
Error Detection and Correction
Even-parity concept
Example 1
Suppose the sender wants to send the word world. In ASCII the five
characters are coded as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
11101110 11011110 11100100 11011000 11001001
Error Detection and Correction
Even-parity concept
Now suppose the word world in Example 1 is received by the
Example 2 receiver without being corrupted in transmission.
11101110 11011110 11100100 11011000 11001001
The receiver counts the 1s in each character and comes up with
even numbers (6, 6, 4, 4, 4). The data are accepted.
Example 4 However, it is hit by a burst noise of length 8, and some bits are
corrupted.
10100011 10001001 11011101 11100111 10101010
When the receiver checks the parity bits, some of the bits do not
follow the even-parity rule and the whole block is discarded.
NOTE: In two-dimensional parity check, a block of bits is divided into rows and a redundant row of bits is added to the whole block.
Error Detection and Correction
CRC generator and checker
Error Detection and Correction
Binary division in a CRC generator
Error Detection and Correction
Binary division in a CRC generator
Error Detection and Correction
A Polynomial
Error Detection and Correction
A Polynomial
The CRC-12
x12 + x11 + x3 + x + 1
Example 6
which has a degree of 12, will detect all burst errors affecting an
odd number of bits, will detect all burst errors with a length less
than or equal to 12, and will detect, 99.97 percent of the time,
burst errors with a length of 12 or more.
Error Detection and Correction
Checksum
Error Detection and Correction
Checksum
The sender follows these steps: The receiver follows these steps:
• The unit is divided into k sections, • The unit is divided into k sections,
each of n bits. each of n bits.
• All sections are added using one’s • All sections are added using one’s
complement to get the sum. complement to get the sum.
4 3 7
5 4 9
6 4 10
7 4 11
Error Detection and Correction
Positions of redundancy bits in Hamming code
Error Detection and Correction
Redundancy bits calculation
Error Detection and Correction
Example of redundancy bit calculation
Error Detection and Correction
Error detection using Hamming code
Error Detection and Correction
Burst error correction example
UNIT-2 TOPICS
Flow Control and Error Control: Stop and Wait Protocol, Sliding
Window, Go-back-N-ARQ Protocol and Selective-Repeat ARQ
Protocol.
Flow Control and Error
Control
Unit -2
Flow Control and Error Control
Flow Control
Flow control coordinates the amount of data that can
be sent before receiving acknowledgement
Computer Networks 3
Flow Control and Error Control
Error Control
Protocols
Computer Networks 5
Flow Control and Error Control
Data Link Elementary or Noiseless Channel
1. Simplest Protocol
The design of the simplest protocol with no flow or error control
08-02-2024
Computer Networks 6
Flow Control and Error Control
Example: Simplest Protocol
Computer Networks 7
Flow Control and Error Control
2. Stop-and-Wait Protocol(Data Link Elementary)
The design of the stop-and-wait protocol
08-02-2024
Computer Networks 8
Flow Control and Error Control
Example: Stop-and-Wait
08-02-2024
Computer Networks 9
Flow Control and Error Control
Noisy Channel (Sliding Window Protocols)
Sliding window refers to imaginary boxes at the transmitter and the
receiver.
08-02-2024
Computer Networks 10
Flow Control and Error Control
Example: Send window for Go-Back-N ARQ
08-02-2024
Computer Networks 11
Flow Control and Error Control
Noisy Channel (Sliding Window Protocols)
08-02-2024
Computer Networks 12
Flow Control and Error Control
Design of Stop-and-Wait ARQ
08-02-2024
Computer Networks 14
Flow Control and Error Control
Example 1: Stop-and-Wait ARQ
08-02-2024
Computer Networks 15
Flow Control and Error Control
Example 2: Stop-and-Wait ARQ
i. An example of Stop-and-Wait ARQ. Frame 0 is sent and acknowledged. Frame 1 is
lost and resent after the time-out. The resent frame 1 is acknowledged and the timer
stops. Frame 0 is sent and acknowledged, but the acknowledgment is lost. The sender
has no idea if the frame or the acknowledgment is lost, so after the time-out, it resends
frame 0, which is acknowledged.
ii. The system can send 20,000 bits during the time it takes for the data to go from the
sender to the receiver and then back again. However, the system sends only 1000 bits.
We can say that the link utilization is only 1000/20,000, or 5 percent. For this reason,
for a link with a high bandwidth or long delay, the use of Stop-and-Wait ARQ wastes
the capacity of the link.
08-02-2024
Computer Networks 16
Flow Control and Error Control
Example 3: Stop-and-Wait ARQ
What is the utilization percentage of the link in Example 2 if we
have a protocol that can send up to 15 frames before stopping and
worrying about the acknowledgments?
Solution
The bandwidth-delay product is still 20,000 bits. The system can send
up to 15 frames or 15,000 bits during a round trip. This means the
utilization is 15,000/20,000, or 75 percent. Of course, if there are
damaged frames, the utilization percentage is much less because
frames have to be resent.
08-02-2024
Computer Networks 17
Flow Control and Error Control
2. Go-Back-N ARQ
The sender window can slide one or more slots when a valid
acknowledgment arrives.
Computer Networks 18
Flow Control and Error Control
Sender window for Go-Back-N ARQ
08-02-2024
Computer Networks 19
Flow Control and Error Control
Receiver window for Go-Back-N ARQ
08-02-2024
Computer Networks 20
Flow Control and Error Control
Design of Go-Back-N ARQ
Note:
08-02-2024
Computer Networks 23
Flow Control and Error Control
Flow Diagram 2 of Go-Back-N ARQ
Computer Networks 25
Flow Control and Error Control
Flow Diagram 3 of Go-Back-N ARQ
Computer Networks
08-02-2024 26
Flow Control and Error Control
Example 2: Go-Back-N ARQ
i. Flow diagram 3 shows what happens when a frame is lost. Frames
0, 1, 2, and 3 are sent. However, frame 1 is lost. The receiver
receives frames 2 and 3, but they are discarded because they are
received out of order. The sender receives no acknowledgment
about frames 1, 2, or 3. Its timer finally expires. The sender sends
all outstanding frames (1, 2, and 3) because it does not know what
is wrong. Note that the resending of frames 1, 2, and 3 is the
response to one single event. When the sender is responding to this
event, it cannot accept the triggering of other events. This means
that when ACK 2 arrives, the sender is still busy with sending
frame 3.
08-02-2024
Computer Networks 27
Flow Control and Error Control
Continue…………Example 2: Go-Back-N ARQ
ii. Flow diagram 3 shows what happens when a frame is lost. Frames
0, 1, 2, and 3 are sent. However, frame 1 is lost. The receiver
receives frames 2 and 3, but they are discarded because they are
received out of order. The sender receives no acknowledgment
about frames 1, 2, or 3. Its timer finally expires. The sender sends
all outstanding frames (1, 2, and 3) because it does not know what
is wrong. Note that the resending of frames 1, 2, and 3 is the
response to one single event. When the sender is responding to this
event, it cannot accept the triggering of other events. This means
that when ACK 2 arrives, the sender is still busy with sending
frame 3.
08-02-2024
Computer Networks 28
Flow Control and Error Control
Note:
08-02-2024
Computer Networks 29
Flow Control and Error Control
3. Selective Repeat ARQ
The sender window can slide one or more slots when a valid
acknowledgment arrives.
08-02-2024
Computer Networks 30
Flow Control and Error Control
Sender and Receiver window for Selective Repeat ARQ
08-02-2024
Computer Networks 31
Flow Control and Error Control
Design of Selective Repeat ARQ
08-02-2024
Computer Networks 34
Flow Control and Error Control
Flow Diagram 4 of Selective-Repeat-ARQ
Computer Networks
08-02-2024 35
Flow Control and Error Control
Example 1 : Selective Repeat ARQ
i. This example is similar to Example 1 of Stop-and-Wait in
which frame 1 is lost. We show how Selective Repeat behaves in
this case. Flow Diagram 4(Stop-and-wait) shows the situation.
One main difference is the number of timers. Here, each frame
sent or resent needs a timer, which means that the timers need
to be numbered (0, 1, 2, and 3). The timer for frame 0 starts at
the first request, but stops when the ACK for this frame arrives.
The timer for frame 1 starts at the second request, restarts when
a NAK arrives, and finally stops when the last ACK arrives. The
other two timers start when the corresponding frames are sent
and stop at the last arrival event.
08-02-2024
Computer Networks 36
Flow Control and Error Control
Continue …...Example 1 : Selective Repeat ARQ
ii. At the receiver site we need to distinguish between the
acceptance of a frame and its delivery to the network layer. At
the second arrival, frame 2 arrives and is stored and marked,
but it cannot be delivered because frame 1 is missing. At the
next arrival, frame 3 arrives and is marked and stored, but still
none of the frames can be delivered. Only at the last arrival,
when finally a copy of frame 1 arrives, can frames 1, 2, and 3 be
delivered to the network layer. There are two conditions for the
delivery of frames to the network layer: First, a set of
consecutive frames must have arrived. Second, the set starts
from the beginning of the window.
08-02-2024
Computer Networks 37
Flow Control and Error Control
Continue …...Example 1 : Selective Repeat ARQ
iii. Another important point is that a NAK is sent after the second
arrival, but not after the third, although both situations look
the same. The reason is that the protocol does not want to
crowd the network with unnecessary NAKs and unnecessary
resent frames. The second NAK would still be NAK1 to inform
the sender to resend frame 1 again; this has already been done.
The first NAK sent is remembered (using the NAK Sent variable)
and is not sent again until the frame slides. A NAK is sent once
for each window position and defines the first slot in the
window.
08-02-2024
Computer Networks 38
Flow Control and Error Control
Continue …...Example 1 : Selective Repeat ARQ
iv. The next point is about the ACKs. Notice that only two ACKs
are sent here. The first one acknowledges only the first frame;
the second one acknowledges three frames. In Selective Repeat,
ACKs are sent when data are delivered to the network layer. If
the data belonging to n frames are delivered in one shot, only
one ACK is sent for all of them.
08-02-2024
Computer Networks 39
Flow Control and Error Control
Design of piggybacking in Go-Back-N ARQ
• ALOHA
• Carrier Sense Multiple Access
• Carrier Sense Multiple Access with Collision Detection
• Carrier Sense Multiple Access with Collision Avoidance
Multiple Access
RANDOM ACCESS,
ALOHA
ALOHA
• Norman Abramson at University of Hawaii, in 70’s wanted to
connect computer centers of all the islands of Hawaii.
• Hawaii is a collection of islands and it was not possible to
connect them with telephone lines.
• Joining islands with wires laid on seabed was very expensive,
so they started thinking about wireless solution.
Multiple Access
RANDOM ACCESS, ALOHA
Solution: ALOHA
CSMA
• TYPES:
• 1. 1 Persistent CSMA
• 2. Non Persistent CSMA
• 3. P Persistent CSMA
• 4. CSMA/CD
Multiple Access
RANDOM ACCESS, CSMA
3. P-persistent CSMA:
Channel Busy Continue sensing until free (same as idle).
Channel Idle Transmit with probability p, and defer
transmitting until the next slot with probability q = 1-p.
Collision Wait for a random length of time and try again.
• Analysis:
• The non-persistent CSMA has better channel utilization but longer
delays than 1-persistent CSMA.
• CSMA are an improvement over ALOHA because they ensure that no
station begins to transmit when it senses the channel busy.
• Another improvement is for stations to abort their transmissions as
soon as they detect a collision.
• Quickly terminating damaged frames saves time and bandwidth.
• This protocol is called CSMA/CD (CSMA with Collision Detection).
Multiple Access
RANDOM ACCESS, CSMA/CD
CSMA/CD
• Carrier Sense: Ethernet card listen to channel before transmission and
differ to transmit if somebody else is already transmitting.
• Multiple Access: More than one user needs channel access.
• Collision Detection: Protocol listen when transmission is going on and
find stop transmitting when it finds colliding.
• Interframe gap: As soon as channel becomes free, it waits for small interframe gap
and then transmits. Interframe gap is idle time between frames. After a frame has
been sent, transmitters are required to transmit a minimum of 96 bits (12 octets)
of idle line state before transmitting the next frame.
Multiple Access
RANDOM ACCESS, CSMA/CD
Collision Avoidance:
CSMA/CA
• Collision Avoidance with Career Sense Multiple Access.
• On Wireless Networks
• Strategies:
• 1. Inter-frame Spacing (IFS)
• 2. Contention Window – Binary Exponential Back off Algorithm
• 3. Acknowledgement
Multiple Access
RANDOM ACCESS, Collision of the first bit in CSMA/CD
Timing in CSMA/CA
In CSMA/CA, if the station finds the channel busy, it does not restart the timer of the
contention window; it stops the timer and restarts it when the channel becomes idle.
In CSMA/CA, the IFS can also be used to define the priority of a station or a frame.
Multiple Access
RANDOM ACCESS, Flow Diagram CSMA/CA
Flow diagram for CSMA/CA
Multiple Access
CONTROLLED ACCESS
In controlled access, the stations consult one another to find which station
has the right to send. A station cannot send unless it has been authorized
by other stations. We discuss three popular controlled-access methods.
• Reservation
• Polling
• Token Passing
Multiple Access
CONTROLLED ACCESS
CHANNELIZATION
Channelization is a multiple-access method in which the available bandwidth of a
link is shared in time, frequency, or through code, between different stations. In
this section, we discuss three channelization protocols.