0% found this document useful (0 votes)
6 views

DC Module3_complete Notes

Uploaded by

Han Jisung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

DC Module3_complete Notes

Uploaded by

Han Jisung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

GUIDED MEDIA

A transmission medium can be broadly defined as anything that can


carry information from a source to a destination.

Classes of transmission media

Guided Media: Guided media, which are those that provide a medium
from one device to another, include twisted-pair cable, coaxial cable, and
fiber-optic cable.

Twisted-Pair Cable: A twisted pair consists of two conductors (normally


copper), each with its own plastic insulation, twisted together. One of the
wires is used to carry signals to the receiver, and the other is used only as a
ground reference.

Unshielded Versus Shielded Twisted-Pair Cable


The most common twisted-pair cable used in communications is referred to
as unshielded twisted-pair (UTP). STP cable has a metal foil or braided mesh
covering that encases each pair of insulated conductors. Although metal
casing improves the quality of cable by preventing the penetration of noise
or crosstalk, it is bulkier and more expensive.

The most common UTP connector is RJ45 (RJ stands for registered jack)

Applications
Twisted-pair cables are used in telephone lines to provide voice and
data channels.
Local-area networks, such as l0Base-T and l00Base-T, also use
twisted-pair cables.

Coaxial Cable
Coaxial cable (or coax) carries signals of higher frequency ranges than those
in twisted pair cable. coax has a central core conductor of solid or stranded
wire (usuallycopper) enclosed in an insulating sheath, which is, in turn,
encased in an outer conductor of metal foil, braid, or a combination of the
two. The outer metallic wrapping serves both as a shield against noise and
as the second conductor, which completes the circuit.This outer conductor
is also enclosed in an insulating sheath, and the whole cable is protected by

a plastic cover.

The most common type of connector used today is the Bayone-Neill-


Concelman (BNe), connector.
Applications
Coaxial cable was widely used in analog telephone networks,digital
telephone networks
Cable TV networks also use coaxial cables.

Another common application of coaxial cable is in traditional Ethernet LANs


Fiber-Optic Cable
A fiber-optic cable is made of glass or plastic and transmits signals in the
form of light. Light travels in a straight line as long as it is moving through
a single uniform substance.
If a ray of light traveling through one substance suddenly enters another
substance(of a different density), the ray changes direction.
Bending of light ray

Optical fibers use reflection to guide light through a channel. A glass or


plastic core is surrounded by a cladding of less dense glass or plastic.

Propagation Modes

Multimode is so named because multiple beams from a light source move


through the core in different paths. How these beams move within the cable
depends on the structure of the core, as shown in Figure.
In multimode step-index fiber, the density of the core remains constant
from the center to the edges. A beam of light moves through this constant
density in a straight line until it reaches the interface of the core and the
cladding. The term step index refers to the suddenness of this change, which
contributes to the distortion of the signal as it passes through the fiber.
A second type of fiber, called multimode graded-index fiber, decreases
this distortion of the signal through the cable. The word index here refers to
the index of refraction.
Single-Mode: Single-mode uses step-index fiber and a highly focused
source of light that limits beams to a small range of angles, all close to the
horizontal.

Fiber Construction

The subscriber channel (SC) connector, The straight-tip (ST)


connector, MT-RJ(mechanical transfer registered jack) is a
connector
Applications
Fiber-optic cable is often found in backbone networks
because
its wide bandwidth is cost-effective..
Some cable TV companies use a combination of optical fiber and
coaxial cable,thus creating a hybrid network.
Local-area networks such as 100Base-FX network (Fast
Ethernet) and 1000Base-X also use fiber-optic cable

Advantages and Disadvantages of Optical Fiber


Advantages Fiber-optic cable has several advantages over metallic
cable (twisted pair or coaxial).
1 Higher bandwidth.
2 Less signal attenuation. Fiber-optic transmission distance is significantly
greater than that of other guided media. A signal can run for 50 km without
requiring regeneration. We need repeaters every 5 km for coaxial or twisted-
pair cable.
3 Immunity to electromagnetic interference. Electromagnetic noise cannot
affect fiber-optic cables.
4 Resistance to corrosive materials. Glass is more resistant to corrosive
materials than copper.
5 Light weight. Fiber-optic cables are much lighter than copper cables.
6 Greater immunity to tapping. Fiber-optic cables are more immune to
tapping than copper cables. Copper cables create antenna effects that can
easily be tapped.
Disadvantages There are some disadvantages in the use of optical fiber.
1Installation and maintenance
2 Unidirectional light propagation. Propagation of light is unidirectional.
If we need bidirectional communication, two fibers are needed.
3 Cost. The cable and the interfaces are relatively more expensive than those
of other guided media. If the demand for bandwidth is not high, often the
use of optical fiber cannot be justified.
Data Communication-BCM502

Module-3 SWITCHING NETWORKS


24. What is switching? List different types of switching.

• A network is a set of connected-devices.


Problem: Whenever we have multiple-devices, we have the problem of how to connect them to
make one-to-one communication possible.
Solution: Use Switching.
• A switched-network consists of a series of interlinked-nodes, called switches.
• Switches are devices capable of creating temporary connections between two or more devices.

Figure 8.1 Switched network

• In a switched-network,
1) Some nodes are connected to the end-systems (For example: PC or TP).
2) Some nodes are used only for routing.

• As shown in Figure 8.1,


1) The end-systems are labeled A, B, C, D, and so on.
2) The switches are labeled I, II, III, IV, and V. Each switch is connected to multiple links.

Three Methods of Switching


• Three methods of Switching are (Figure 8.2):
1) Circuit Switching
2) Packet Switching and
3) Message Switching.
• The first two are commonly used today.
• The third has been phased out in general communications but still has networking applications.
• Packet switching can further be divided into two subcategories—virtual circuit approach and
datagram approach

Dept. of CCE KSIT-2023-24 Page 1


Data Communication-BCM502

Figure 8.2 Taxonomy of switched networks

25. With a neat diagram explain circuit switched network.

Figure 8.3 A trivial circuit-switched network

• This is similar to telephone system.


• Fixed path (connection) is established between a source and a destination prior to the transfer
of packets.
• A circuit-switched-network consists of a set of switches connected by physical-links
(Figure 8.3).
• A connection between 2 stations is a dedicated-path made of one or more links.
• However, each connection uses only one dedicated-channel on each link.
• Normally, each link is divided into „n‟ channels by using FDM or TDM.
• The resources need to be reserved during the setup phase.

The resources remain dedicated for the entire duration of data transfer until the teardown phase.
• The virtual-circuit setup procedure
→ first determines a path through the network &
→ sets parameters in the switches by exchanging connect-request & connect-confirm messages

Dept. of CCE KSIT-2023-24 Page 2


Data Communication-BCM502

• If a switch does not have enough resources to set up a virtual circuit, the switch responds with a
connect-reject message and the setup procedure fails (Figure 7.15).
• A connection-release procedure may also be required to terminate the connection.

2.7.1 Three Phases


• The communication requires 3 phases: 1) Connection-setup
2) Data-transfer
3) Connection teardown.
1) Setup Phase
Before the 2 parties can communicate, a dedicated-circuit needs to be established.
Normally, the end-systems are connected through dedicated-lines to the switches.
So, connection-setup means creating dedicated-channels between the switches.
For ex: Assume system-A needs to connect to system-M. For this, following events occur:
i) System-A sends a setup-request to switch-I.
ii) Switch-I finds a channel between itself and switch-IV that can be dedicated for this
purpose.
iii) Switch-I then sends the request to switch-IV, which finds a dedicated-channel
between itself and switch-III.
iv) Switch-III informs system-M of system-A's intention at this time.
v) Finally, an acknowledgment from system-M needs to be sent in the opposite direction to
system-A.
Only after system A receives this acknowledgment is the connection established.
2) Data Transfer Phase
After the establishment of the dedicated-circuit (channels), the two parties can transfer data.
3) Teardown Phase
When one of the parties needs to disconnect, a signal is sent to each switch to release
theresources.
Efficiency
• Circuit-switched-networks are inefficient when compared to other two types of networks
because
1) Resources are allocated during the entire duration of the connection.
2) These resources are unavailable to other connections.
Delay
• Circuit-switched-networks have minimum delay when compared to other two types of
networks
• During data-transfer,
1) The data are not delayed at each switch.
2) The resources are allocated for the duration of the connection.
As in the above figure, there is no waiting time at each switch.
The total delay is the time needed to
1) Create the connection
2) Transfer-data and
3) Disconnect the circuit.
The delay caused by the setup is the sum of 4 parts:
1) The propagation time of the source-computer request.
2) The request signal transfer time.

Dept. of CCE KSIT-2023-24 Page 3


Data Communication-BCM502

3) The propagation time of the acknowledgment from the destination computer.


4) The signal transfer time of the acknowledgment.

Figure 8.6 Delay in a circuit-switched network


The delay due to data-transfer is the sum of 2 parts:
1) The propagation time.
2) Data-transfer time which can be very long.

26. With neat diagram explain datagram networks

• This is analogous to postal system.


• Each packet is routed independently through the network.
• Each packet has a header that contains source and destination addresses.
• Each switch examines the header to determine the next hop in the path to the destination.
• If the transmission line is busy
then the packet is placed in the queue until the line becomes free.
• Packets are referred to as datagrams.
• Datagram switching is normally done at the network layer.
• In Internet, switching is done by using the datagram switching.
• Advantage:
1) High utilization of transmission-line can be achieved by sharing among multiple packets.
• Disadvantages:
1) Packets may arrive out-of-order, and re-sequencing may be required at the destination
2) Loss of packets may occur when a switch has insufficient buffer

Dept. of CCE KSIT-2023-24 Page 4


Data Communication-BCM502

Figure 8.7 A datagram network with four switches (routers)

The Figure 8.7 shows how the 4 packets are transferred from station-A to station-X.
The switches are referred to as routers.
All four packets (or datagrams) belong to the same message, but may travel different paths to
reach their destination.
This is so because the links may be involved in carrying packets from other sources and do not
have the necessary bandwidth available to carry all the packets from A to X.
This approach can cause the datagrams of a transmission to arrive at their destination out-
oforder with different delays between the packets.
Packets may also be lost or dropped because of a lack-of-resources.
It is the responsibility of an upper-layer protocol to
→ reorder the datagrams or
→ ask for lost datagrams.
The datagram-networks are referred to as connectionless networks. This is because
1) The switch does not keep information about the connection state.
2) There are no setup or teardown phases.
3) Each packet is treated the same by a switch regardless of its source or destination

Routing Table
• Each switch has a routing-table which is based on the destination-address.
• The routing-tables are dynamic & updated periodically.
• The destination-addresses and the corresponding forwarding output-ports are recorded in the
tables.

Dept. of CCE KSIT-2023-24 Page 5


Data Communication-BCM502

Figure 8.8 Routing table in a datagram network

Destination Address
• Every packet carries a header that contains the destination-address of the packet.
• When the switch receives the packet,
→ This destination-address is examined.
→ The routing-table is consulted to find the corresponding port through which the packet
should be forwarded.
• The destination address in the header of a packet in remains the same during the entire journey
of the packet.
Efficiency
• Datagram-networks are more efficient when compared to circuit-switched-network. This is
because
1) Resources are allocated only when there are packets to be transferred.
2) If a source sends a packet and there is a delay of a few minutes before another packet can be
sent, the resources can be re-allocated during these minutes for other packets from other sources.

Figure 8.9 Delay in a datagram network

Dept. of CCE KSIT-2023-24 Page 6


Data Communication-BCM502

Delay
• Datagram-networks may have greater delay when compared to circuit-switched-network. This
is because
1) Each packet may experience a wait at a switch before it is forwarded.
2) Since not all packets in a message necessarily travel through the same switches, the delay is
not uniform for the packets of a message.
The Figure 8.9 gives an example of delay for one single packet.
The packet travels through two switches.
There are three transmission times (3T), three propagation delays (slopes 3t of the lines), and
two waiting times (W1+ W2).

27. With a neat diagram explain virtual circuit networks.

Solution: Virtual Circuit Network (VCN)


• This is similar to telephone system.
• A virtual-circuit network is a combination of circuit-switched-network and datagram-network.
• Five characteristics of VCN:
1) As in a circuit-switched-network, there are setup & teardown phases in addition to the data
transfer phase.
2) As in a circuit-switched-network, resources can be allocated during the setup phase.
As in a datagram-network, resources can also be allocated on-demand.
3) As in a datagram-network, data is divided into packets.
Each packet carries an address in the header.
However, the address in the header has local jurisdiction, not end-to-end jurisdiction.
4) As in a circuit-switched-network, all packets follow the same path established during the
connection.
5) A virtual-circuit network is implemented in the data link layer.
A circuit-switched-network is implemented in the physical layer.

Figure 8.10 Virtual-circuit Network

Dept. of CCE KSIT-2023-24 Page 7


Data Communication-BCM502

A datagram-network is implemented in the network layer.


The Figure 8.10 is an example of a virtual-circuit network.
The network has switches that allow traffic from sources to destinations.
A source or destination can be a computer, packet switch, bridge, or any other device that
connects other networks.
Addressing
• Two types of addressing:1) Global and 2) Local (virtual-circuit identifier).
1) Global Addressing
A source or a destination needs to have a global address.
Global address is an address that can be unique in the scope of the network or internationally
if the network is part of an international network.

Figure 8.11 Virtual-circuit identifier

2) Virtual Circuit Identifier


The identifier used for data-transfer is called the virtual-circuit identifier (VCI).
A VCI, unlike a global address, is a small number that has only switch scope.
VCI is used by a frame between two switches.
When a frame arrives at a switch, it has a VCI.
When the frame leaves, it has a different VCI.
Figure 8.11 show how the VCI in a data-frame changes from one switch to another Three
Phases
• A source and destination need to go through 3 phases: setup, data-transfer, and teardown.
1) In setup phase, the source and destination use their global addresses to help switches
make table entries for the connection.
2) In the teardown phase, the source and destination inform the switches to delete the
corresponding entry.
3) Data-transfer occurs between these 2 phases.
Data Transfer Phase
• To transfer a frame from a source to its destination, all switches need to have a table-entry for
this virtual-circuit.
• The table has four columns.
• The switch holds 4 pieces of information for each virtual-circuit that is already set up.

Dept. of CCE KSIT-2023-24 Page 8


Data Communication-BCM502

Figure 8.12 Switch and tables in a virtual-circuit network

As shown in Figure 8.12, a frame arrives at port 1 with a VCI of 14.


When the frame arrives, the switch looks in its table to find port 1 and a VCI of 14.
When it is found, the switch knows to change the VCI to 22 & send out the frame from port 3.
As shown in Figure 8.13, each switch changes the VCI and routes the frame.
The data-transfer phase is active until the source sends all its frames to the destination.
The procedure at the switch is the same for each frame of a message.
The process creates a virtual circuit, not a real circuit, between the source and destination.

Figure 8.13 Source-to-destination data transfer in a virtual-circuit network

Dept. of CCE KSIT-2023-24 Page 9


Data Communication-BCM502

Setup Phase
• A switch creates an entry for a virtual-circuit.
• For example, suppose source A needs to create a virtual-circuit to B.
• Two steps are required: 1) Setup-request and
2) Acknowledgment.
1) Setup Request
A setup-request frame is sent from the source to the destination (Figure 8.14).

Figure 8.14 Setup request in a virtual-circuit network


Following events occurs:
a) Source-A sends a setup-frame to switch-1.
b) Switch-1 receives the setup-frame.
¤ Switch-1 knows that a frame going from A to B goes out through port 3. ¤
The switch-1 has a routing table.
¤ The switch
→ creates an entry in its table for this virtual-circuit
→ is only able to fill 3 of the 4 columns.
¤ The switch
→ assigns the incoming port (1) and
→ chooses an available incoming-VCI (14) and the outgoing-port (3).
→does not yet know the outgoing VCI, which will be found during the
acknowledgment step.
¤ The switch then forwards the frame through port-3 to switch-2.
c) Switch-2 receives the setup-request frame.
¤ The same events happen here as at switch-1.
¤ Three columns of the table are completed: In this case, incoming port (1),
incoming-VCI (66), and outgoing port (2).
d) Switch-3 receives the setup-request frame.
¤ Again, three columns are completed: incoming port (2), incoming-VCI (22), and
outgoing-port (3).

Dept. of CCE KSIT-2023-24 Page 10


Data Communication-BCM502

e) Destination-B
→ receives the setup-frame
→ assigns a VCI to the incoming frames that come from A, in this case 77.
¤ This VCI lets the destination know that the frames come from A, and no other
sources.

2) Acknowledgment
A special frame, called the acknowledgment-frame, completes the entries in the
Switching tables (Figure 8.15).

Figure 8.15 Setup acknowledgments in a virtual-circuit network

a) The destination sends an acknowledgment to switch-3.


¤ The acknowledgment carries the global source and destination-addresses so the
switch knows which entry in the table is to be completed.
¤ The frame also carries VCI 77, chosen by the destination as the incoming-VCI for
frames from A.
¤ Switch 3 uses this VCI to complete the outgoing VCI column for this entry.
b) Switch 3 sends an acknowledgment to switch-2 that contains its incoming-VCI in the
table, chosen in the previous step.
¤ Switch-2 uses this as the outgoing VCI in the table.
c) Switch-2 sends an acknowledgment to switch-1 that contains its incoming-VCI in the
table, chosen in the previous step.
¤ Switch-1 uses this as the outgoing VCI in the table.
d) Finally switch-1 sends an acknowledgment to source-A that contains its incoming-VCI in
the table, chosen in the previous step.
e) The source uses this as the outgoing VCI for the data-frames to be sent to
destination-B.

Dept. of CCE KSIT-2023-24 Page 11


Data Communication-BCM502

Teardown Phase
• Source-A, after sending all frames to B, sends a special frame called a teardown request.
• Destination-B responds with a teardown confirmation frame.
• All switches delete the corresponding entry from their tables.
Efficiency
• Resource reservation can be made in 2 cases:
1) During the setup: Here, the delay for each packet is the same.
2) On demand: Here, each packet may encounter different delays.
• Advantage of on demand resource allocation:
The source can check the availability of the resources, without actually reserving it.
Delay in Virtual Circuit Networks
• There is a one-time delay for setup and a one-time delay for teardown (Figure 8.16).
• If resources are allocated during the setup phase, there is no wait time for individual packets.
• The packet is traveling through two switches (routers).
• There are three transmission times (3T), three propagation times (3τ), data transfer delay, a
setup delay and a teardown delay.
• The total delay time is

Figure 8.16 Delay in a virtual-circuit network

28. Explain Switching and TCP/IP Layers


• Switching can happen at several layers of the TCP/IP protocol suite.
1) Switching at Physical Layer
At the physical layer, we can have only circuit switching.
There are no packets exchanged at the physical layer.
The switches at the physical layer allow signals to travel in one path or another.
2) Switching at Data-Link Layer
At the data-link layer, we can have packet switching.
However, the term packet in this case means frames or cells.
Packet switching at the data-link layer is normally done using a virtual-circuit approach.
3) Switching at Network Layer
At the network layer, we can have packet switching.

Dept. of CCE KSIT-2023-24 Page 12


Data Communication-BCM502

In this case, either a virtual-circuit approach or a datagram approach can be used.


Currently the Internet uses a datagram approach, but the tendency is to move to a virtualcircuit
approach.
4) Switching at Application Layer
At the application layer, we can have only message switching.
The communication at the application layer occurs by exchanging messages.
Conceptually, we can say that communication using e-mail is a kind of message-switched
communication, but we do not see any network that actually can be called a message-switched
network.

29 Differentiate between circuit switched, datagram networks and virtual circuit


networks. (Dec 2012 / June 2013)

Solution

Sl. No Circuit Switched Datagram networks Virtual circuit networks


networks
1 Connection Oriented Connectionless service Connection Oriented service
service
2 3 phases: No Connection setup and tear 3 phases: Connection setup,
Connection setup, down phases data transfer and tear down
data transfer and tear
down
3 Resources are Resources are allocated on Resources are allocated at
allocated at setup demand setup phase or on demand
phase
4 Data is sent as it is Data are packetized and each Data are packetized and each
(Not packetized) packet carries an address in packet carries an address in
the header the header
5 Addressing is not One type of address: global Two types of addressing:
required addressing Local and global virtual
circuit identifier
6 Data follows same Packets may follow different Packets follows same path
path established in path established in connection established in connection
connection setup setup phase. setup phase.
phase.
7 Data delivered in Packets may be deliver Packets are delivered in
inorder unordered inorder
8 Usually Usually implemented at Usually implemented at data
implemented at network layer link layer
physical layer
9 These networks Efficiency is better than Less efficient compared to
have low efficiency circuit switched network datagram network
10 Delay is minimal Delay is more compared to One time delay for
compared to other virtual circuit network connection setup and tear
two. down

Dept. of CCE KSIT-2023-24 Page 13


Data Communication-BCM502

MODULE 3: ERROR-DETECTION AND


CORRECTION
3.1 INTRODUCTION
3.1.1 Types of Errors
• When bits flow from 1 point to another, they are subject to unpredictable-changes ‘.’ of
interference.
• The interference can change the shape of the signal.
• Two types of errors: 1) Single-bit error 2)Burst-error.

a) Single-Bit error

b) Burst error

Figure 10.1 Single-bit and burst error

1) Single-Bit Error
Only 1 bit of a given data is changed
→ from 1 to 0 or
→ from 0 to 1 (Figure 10.1a).
2) Burst Error
Two or more bits in the data have changed
→ from 1 to 0 or
→ from 0 to 1 (Figure 10.1b).
A burst-error occurs more than a single-bit error. This is because: Normally, the duration of
noise is longer than the duration of 1-bit.
When noise affects data, the noise also affects the bits.
The no. of corrupted-bits depends on
→ data-rate and

Dept. of CCE KSIT-2023-24 Page 14


Data Communication-BCM502

→ duration of noise.

3.1.2 Redundancy
• The central concept in detecting/correcting errors is redundancy.
• Some extra-bits along with the data have to be sent to detect/correct errors. These extra bits are
called redundant-bits.
• The redundant-bits are
→ added by the sender and
→ removed by the receiver.
• The presence of redundant-bits allows the receiver to detect/correct errors.

3.1.3 Error Detection vs. Error Correction

• Error-correction is more difficult than error-detection.


1) Error Detection
Here, we are checking whether any error has occurred or not.
The answer is a simple YES or NO.
We are not interested in the number of corrupted-bits.
2) Error Correction
Here, we need to know
→ exact number of corrupted-bits and
→ location of bits in the message.
Two important factors to be considered:
1) Number of errors and
2) Message-size.

3.1.4 Coding
• Redundancy is achieved through various coding-schemes.
1) Sender adds redundant-bits to the data-bits. This process creates a relationship between
→ redundant-bits and
→ data-bits.
2) Receiver checks the relationship between redundant-bits & data-bits to detect/correct errors.
• Two important factors to be considered:
1) Ratio of redundant-bits to the data-bits and
2) Robustness of the process.
• Two broad categories of coding schemes: 1) Block-coding and 2) Convolution coding.
3.2 Block Coding
• The message is divided into k-bit blocks. These blocks are called data-words.
• Here, r-redundant-bits are added to each block to make the length n=k+r.
• The resulting n-bit blocks are called code-words.
• Since n>k, the number of possible code-words is larger than the number of possible data-words.
• Block-coding process is 1-to-1; the same data-word is always encoded as the same code-word.
• Thus, we have 2n-2k code-words that are not used. These code-words are invalid or illegal.
3.2.1 Error Detection
• If the following 2 conditions are met, the receiver can detect a change in the original code-
word:
1) The receiver has a list of valid code-words.

Dept. of CCE KSIT-2023-24 Page 15


Data Communication-BCM502

2) The original code-word has changed to an invalid code-words.


• Here is how it works (Figure 10.2):

Figure 10.2 Process of error detection in block coding

1) At Sender
i) The sender creates code-words out of data-words by using a generator.
The generator applies the rules and procedures of encoding.
ii) During transmission, each code-word sent to the receiver may change.
2) At Receiver
i) a) If the received code-word is the same as one of the valid code-words,
the code-word is accepted;
the corresponding data-word is extracted for use.
b) If the received code-word is invalid, the code-word is discarded.
ii) However, if the code-word is corrupted but the received code-word still matches a valid
codeword, the error remains undetected.
• An error-detecting code can detect only the types of errors for which it is designed; other
types of errors may remain undetected.

Example 10.1
Let us assume that k = 2 and n = 3. Table 10.1 shows the list of datawords and codewords.
Later, we will see how to derive a codeword from a dataword. Assume the sender encodes
the dataword 01 as 011 and sends it to the receiver. Consider the following cases:
1. The receiver receives 011. It is a valid codeword. The receiver extracts the dataword 01
from it.
2. The codeword is corrupted during transmission, and 111 is received (the leftmost bit is
corrupted).This is not a valid codeword and is discarded.
3. The codeword is corrupted during transmission, and 000 is received (the right two bits
are corrupted). This is a valid codeword. The receiver incorrectly extracts the dataword 00.
Two corrupted bits have made the error undetectable.

Dept. of CCE KSIT-2023-24 Page 16


Data Communication-BCM502

Modular Arithmetic
In modulo-N arithmetic, we use only the integers in the range 0 to N - 1, inclusive.
In modulus 2 arithmetic, we use only 0 and 1. Operations in this arithmetic are very simple.
The following shows how we can add or subtract 2 bits.

Adding: 0+0=0, 0-0=0, 0+1=1 and 0-1=1 Subtracting: 1+0=1, 1-0=1, 1+1=0 and 1-1=0
Notice particularly that addition and subtraction give the same results. In this arithmetic we use the
XOR (exclusive OR) operation for both addition and subtraction

Hamming Distance
One of the central concepts in coding for error control is the idea of the Hamming distance.
The Hamming distance between two words (of the same size) is the number of differences
between the corresponding bits.
We show the Hamming distance between two words x and y as d(x, y).
The Hamming distance can easily be found if we apply the XOR operation on the two words
and count the number of 1s in the result.
Let us find the Hamming distance between two pairs of words.
1. The Hamming distance d(000, 011) is 2 because

2. The Hamming distance d(10101, 11110) is 3 because

Hamming Distance and Error


Hamming distance between the received word and the sent code-word is the number of
bits that
are corrupted during transmission.
For example: Let Sent code-word = 00000
Received word = 01101
Hamming distance = d(00000, 01101) =3. Thus, 3 bits are in error.
3.2.1.1.1 Minimum Hamming Distance for Error Detection
• Minimum Hamming distance is the smallest Hamming distance b/w all possible pairs of
code-words.

Dept. of CCE KSIT-2023-24 Page 17


Data Communication-BCM502

• Let dmin = minimum Hamming distance.


• To find dmin value, we find the Hamming distances between all words and select the
smallest one.
Minimum-distance for Error-detection
If ‘s’ errors occur during transmission, the Hamming distance b/w the sent code-word and
received code-word is ‘s’ (Figure 10.3).

If code has to detect upto ‘s’ errors, the minimum-distance b/w the valid codes must be
‘s+1’ i.e. dmin=s+1.
We use a geometric approach to define dmin=s+1.
¤ Let us assume that the sent code-word x is at the center of a circle with radius s.
¤ All received code-words that are created by 0 to s errors are points inside the circle or on
the perimeter of the circle.
¤ All other valid code-words must be outside the circle
• For example: A code scheme has a Hamming distance dmin = 4.
This code guarantees the detection of upto 3 errors (d = s + 1 or s = 3).
3.2.1.3 Parity Check Code
• This code is a linear block code. This code can detect an odd number of errors.
• A k-bit data-word is changed to an n-bit code-word where n=k+1.
• One extra bit is called the parity-bit.
• The parity-bit is selected to make the total number of 1s in the code-word even.
• Minimum hamming distance dmin = 2. This means the code is a single-bit error-detecting
code.
• Here is how it works (Figure 10.4):

Dept. of CCE KSIT-2023-24 Page 18


Data Communication-BCM502

Figure 10.4 Encoder and decoder for simple parity-check code


1) At Sender
The encoder uses a generator that takes a copy of a 4-bit data-word (a0, a1, a2, and a3)
and generates a parity-bit r0.
The encoder
→ accepts a copy of a 4-bit data-word (a0, a1, a2, and a3) and
→ generates a parity-bit r0 using a generator
→ generates a 5-bit code-word
The parity-bit & 4-bit data-word are added to make the number of 1s in the code-word
even.
The addition is done by using the following:

The result of addition is the parity-bit.


1) If the no. of 1s in data-word = even, result = 0. (r0=0)
2) If the no. of 1s in data-word = odd, result = 1. (r0=1)
3) In both cases, the total number of 1s in the code-word is even.
The sender sends the code-word, which may be corrupted during transmission.
2) At Receiver
The receiver receives a 5-bit word.
The checker performs the same operation as the generator with one exception:
The addition is done over all 5 bits.

The result is called the syndrome bit (so).


Syndrome bit = 0 when the no. of 1s in the received code-word is even; otherwise, it is 1.
The syndrome is passed to the decision logic analyzer.
1) If s0=0, there is no error in the received code-word. The data portion of the received
code-word is accepted as the data-word.
2) If s0=1, there is error in the received code-word. The data portion of the received

Dept. of CCE KSIT-2023-24 Page 19


Data Communication-BCM502

code-word is discarded. The data-word is not created.

3.3 Cyclic Codes


• Cyclic codes are special linear block codes with one extra property:
If a code-word is cyclically shifted (rotated), the result is another code-word.
For ex: if code-word = 1011000 and we cyclically left-shift, then another code-word =
0110001.
• Let First-word = a0 to a6 and Second-word = b0 to b6, we can shift the bits by using the
following:

3.3.1 Cyclic Redundancy Check (CRC)


• CRC is a cyclic code that is used in networks such as LANs and WANs.

Figure 10.5 CRC encoder and decoder

• Let Size of data-word = k bits (here k=4).

Dept. of CCE KSIT-2023-24 Page 20


Data Communication-BCM502

Size of code-word = n bits (here n=7).


Size of divisor = n-k+1 bits (here n-k+1=4). (Augmented increased)
• Here is how it works (Figure 10.5):
1) At Sender
n-k 0s is appended to the data-word to create augmented data-word. (here n-k=3).
The augmented data-word is fed into the generator (Figure 10.6).

Figure 10.6 Division in CRC encoder

The generator divides the augmented data-word by the divisor.


The remainder is called check-bits (r2r1r0).
The check-bits (r2r1r0) are appended to the data-word to create the code-word.
2) At Receiver
The possibly corrupted code-word is fed into the checker.
The checker is a replica of the generator.
The checker divides the code-word by the divisor.
The remainder is called syndrome bits (r2r1r0).
The syndrome bits are fed to the decision-logic-analyzer.
The decision-logic-analyzer performs following functions:
i) For No Error
¤ If all syndrome-bits are 0s, the received code-word is accepted.
¤ Data-word is extracted from received code-word (Figure 10.7a).

ii) For Error

Dept. of CCE KSIT-2023-24 Page 21


Data Communication-BCM502

¤ If all syndrome-bits are not 0s, the received code-word is discarded (Figure 10.7b).

Figure 10.7 Division in the CRC decoder for two cases


Example 3.3

3.3.2 Polynomials

Dept. of CCE KSIT-2023-24 Page 22


Data Communication-BCM502

• A pattern of 0s and 1s can be represented as a polynomial with coefficients of 0 and 1


(Figure 10.8).

Figure 10.8 A polynomial to represent a binary word

• The power of each term shows the position of the bit; the coefficient shows the value of
the bit.
3.3.3 Cyclic Code Encoder Using Polynomials
• Let Data-word = 1001 = x^3+1.
Divisor = 1011 = x^3+x+1.
• In polynomial representation, the divisor is referred to as generator polynomial t(x)
(Figure 10.9).

Figure 10.9 CRC division using polynomials

Dept. of CCE KSIT-2023-24 Page 23


Data Communication-BCM502

3.3.4 Cyclic Code Analysis


• We define the following, where f(x) is a polynomial with binary coefficients:

Single Bit Error


• If the generator has more than one term and the coefficient of x0 is 1, all single-bit errors
can be caught.
Two Isolated Single-Bit Errors
• If a generator cannot divide xi+1 (t between 0 & n-1), then all isolated double errors can
be detected (Figure 10.10).

Figure 10.10 Representation of two isolated single-bit errors using polynomials


Odd Numbers of Errors
• A generator that contains a factor of x+1 can detect all odd-numbered errors.

Dept. of CCE KSIT-2023-24 Page 24


Data Communication-BCM502

3.3.5 Advantages of Cyclic Codes


• The cyclic codes have a very good performance in detecting
→ single-bit errors
→ double errors
→ odd number of errors and
→ burst-errors.
• They can easily be implemented in hardware and software. They are fast when
implemented in hardware
3.4 Checksum
• Checksum is an error-detecting technique.
• In the Internet,
→The checksum is mostly used at the network and transport layer. →
The checksum is not used in the data link layer.
• Like linear and cyclic codes, the checksum is based on the concept of redundancy.
• Here is how it works (Figure 10.15):

Figure 10.15 Checksum

Dept. of CCE KSIT-2023-24 Page 25


Data Communication-BCM502

1) At Source
Firstly the message is divided into m-bit units.
Then, the generator creates an extra m-bit unit called the checksum.
The checksum is sent with the message.
2) At Destination
The checker creates a new checksum from the combination of the message and
Sent checksum.
i) If the new checksum is all 0s, the message is accepted.
ii) If the new checksum is not all 0s, the message is discarded

3.4.1 Concept of Checksum


Consider the following example:
Example 3.4
• Our data is a list of five 4-bit numbers that we want to send to a destination.
• In addition to sending these numbers, we send the sum of the numbers.
• For example:
Let set of numbers = (7, 11, 12, 0, 6).
We send (7, 11, 12, 0, 6, 36), where 36 is the sum of the original numbers.
• The receiver adds the five numbers and compares the result with the sum.
• If the result & the sum are the same,
The receiver assumes no error, accepts the five numbers, and discards the sum.
Otherwise, there is an error somewhere and the data are not accepted.
Example 3.5
• To make the job of the receiver easy if we send the negative (complement) of the sum,
called the checksum.
• In this case, we send (7, 11, 12, 0, 6, -36).
• The receiver can add all the numbers received (including the checksum).
• If the result is 0, it assumes no error; otherwise, there is an error.
3.4.1.1 One's Complement
• The previous example has one major drawback.
All of our data can be written as a 4-bit word (they are less than 15) except for the
checksum.
• Solution: Use one's complement arithmetic.
We can represent unsigned numbers between 0 and 2^(n-1) using only n bits.
If the number has more than n bits, the extra leftmost bits need to be added to the n
Right most bits (wrapping).
A negative number can be represented by inverting all bits (changing 0 to 1 and 1 to 0).
This is the same as subtracting the number from 2^(n-1).

Dept. of CCE KSIT-2023-24 Page 26


Data Communication-BCM502

3.4.1.2 Internet Checksum


• Traditionally, the Internet has been using a 16-bit checksum.
• The sender or the receiver uses five steps

3.4.1.3 Algorithm
3.4.2 Other Approaches to the Checksum
• If two 16-bit items are transposed in transmission, the checksum cannot catch this error.
• The reason is that the traditional checksum is not weighted: it treats each data item
equally.
• In other words, the order of data items is immaterial to the calculation.
• Two approaches have been used to prevent this problem: 1)Fletcher and 2)Adler

Dept. of CCE KSIT-2023-24 Page 27


Data Communication-BCM502

3.4.2.1 Fletcher Checksum


• The Fletcher checksum was devised to weight each data item according to its position.
• Fletcher has proposed two algorithms: 8-bit and 16-bit (Figure 10.18).
• The first, 8-bit Fletcher, calculates on 8-bit data items and creates a 16-bit checksum.
• The second, 16-bit Fletcher, calculates on 16-bit data items and creates a 32-bit
checksum.
• The 8-bit Fletcher is calculated over data octets (bytes) and creates a 16-bit checksum.
• The calculation is done modulo 256 (28), which means the intermediate results are
divided by 256 and the remainder is kept.
• The algorithm uses two accumulators, L and R.
• The first simply adds data items together; The second adds a weight to the calculation.

Dept. of CCE KSIT-2023-24 Page 28


Data Communication-BCM502

3.4.2.2 Adler Checksum

Figure 10.19 Algorithm to calculate an Adler checksum

• The Adler checksum is a 32-bit checksum.


• It is similar to the 16-bit Fletcher with three differences (Figure 10.19).
1) Calculation is done on single bytes instead of 2 bytes at a time.
2) The modulus is a prime number (65,521) instead of 65,536.
3) L is initialized to 1 instead of 0.
• A prime modulo has a better detecting capability in some combinations of data

Dept. of CCE KSIT-2023-24 Page 29

You might also like