CN (Unit 2)
CN (Unit 2)
Note:
A simple parity-check code is a single-bit error-detecting code
in which n = k + 1 with dmin = 2.
Error Detection and Correction
Hamming Code
Hamming code is a set of error-correction codes that can be
used to detect and correct the errors that can occur when
the data is moved or stored from the sender to the receiver.
It is technique developed by R.W. Hamming for error
correction.
Redundant bits –
The number of redundant bits can be calculated using the
following formula:
2r >= m+r+1
Where, r = number of redundant bits, and
m = number of data bits
Error Detection and Correction
Algorithm of Hamming code
1. Write the bit positions starting from 1.
2. All the bit positions that are a power of 2 are marked as parity
bits (1, 2, 4, 8, etc).
3. All the other bit positions are marked as data bits.
4. Each data bit is included in a unique set of parity bits, as
determined its bit position in binary form.
Parity bit 1 covers all the bits positions whose binary representation
includes a 1 in the least significant position (1, 3, 5, 7, 9, 11, etc).
Parity bit 2 covers all the bits positions whose binary representation
includes a 1 in the second position from the least significant bit (2, 3, 6, 7,
10, 11, etc).
Parity bit 4 covers all the bits positions whose binary representation
includes a 1 in the third position from the least significant bit (4–7, 12–15,
20–23, etc).
Parity bit 8 covers all the bits positions whose binary representation
includes a 1 in the fourth position from the least significant bit bits (8–15,
24–31, 40–47, etc).
Error Detection and Correction
In general, each parity bit covers all bits where the bitwise AND of
the parity position and the bit position is
non-zero.
5. Set a parity bit to 1 if the total number of ones in the
positions it checks is odd.
6. Set a parity bit to 0 if the total number of ones in the
positions it checks is even.
Error Detection and Correction
Ex. Construct an even parity Hamming code word for a data word 1011001.
Solution:
Step-1: First we compute the number of redundant bits r.
Here, number of bits in the given data word (1011001), m = 7
Therefore, we compute r as following:-
2r >= m+r+1 2r >= 7+r+1
Minimum value of r which satisfies above inequality = 4.
Therefore, r=4.
Step-2: Now, we compute the position of redundant bits in the codeword.
These redundancy bits are placed at positions that correspond to the
power of 2. Therefore, the position these redundant bits will be 1, 2, 4 and
8.
Error Detection and Correction
Step-3: Now, we compute the codeword.
Since the data to be transmitted is 1011001, therefore the bits will be
placed as follows:
To find the redundant bit R1, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R1 is an even
number the value of R1 (parity bit’s value) = 0
Error Detection and Correction
R2 bit is calculated using parity check at all the bits positions whose
binary representation includes a 1 in the second position from the least
significant bit. R2: bits 2,3,6,7,10,11.
To find the redundant bit R2, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R2 is odd the
value of R2(parity bit’s value)=1
Error Detection and Correction
R4 bit is calculated using parity check at all the bits positions whose
binary representation includes a 1 in the third position from the least
significant bit. R4: bits 4, 5, 6, 7.
To find the redundant bit R4, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R4 is odd the
value of R4(parity bit’s value) = 1.
Error Detection and Correction
R8 bit is calculated using parity check at all the bits positions whose
binary representation includes a 1 in the fourth position from the least
significant bit. R8: bit 8, 9, 10, 11.
To find the redundant bit R8, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R8 is an even
number the value of R8(parity bit’s value)= 0. Thus, the data transferred
is:
Error Detection and Correction
Error detection and correction: Suppose in the above example the 6th bit is
changed from 0 to 1 during data transmission, then it gives new parity
values in the binary number:
The bits give the binary number 0110 whose decimal representation is 6.
Thus, bit 6 contains an error. To correct the error the 6th bit is changed
from 1 to 0.
Error Detection and Correction
Cyclic Redundancy Check (CRC)
Suppose size of dataword is k-bits.
This technique uses a divisor to find a codeword.
Suppose size of divisor is m-bits.
At sender end:
The codeword corresponding to dataword is found in the
following way:-
1. First we find a word by augmenting m-1 0’s to the right
end of the dataword.
2. Now, we divide this new word by the divisor and find a
remainder.
3. Codeword is obtained by augmenting the remainder to
the right end of dataword.
Error Detection and Correction
At receiver end:
The dataword at the receiver end is found in the following
way:-
1. First we divide the received codeword by divisor and find
the remainder.
2. Remainder is called syndrome. If remainder is zero, then
dataword will be accepted otherwise dataword will be
rejected or discorded.
3. If remainder is zero, then dataword will be found by
removing m-1 least significant bits of received codeword.
Error Detection and Correction
Example: If divisor is 1101, then find codeword corresponding
to the dataword 100100.
Solution:
Efficiency = N/(1+2a),
The minimum value of the sender’s window size in terms of the number
of frames, (rounded to the nearest integer) needed to achieve a link
utilization of 50% is _________.
Media Access Control
Media Access Control
Data link layer is considered as two sub-layers.
The upper sub-layer is responsible for data link
control. The upper sub-layer that is responsible for
flow and error control is called the logical link
control (LLC) layer.
The lower sub-layer is responsible for resolving
access to the shared media. The lower sub-layer
that is mostly responsible for multiple access
resolution is called the media access control (MAC)
layer.
Media Access Control
When nodes or stations are connected and use a common
link, called a multipoint or broadcast link, we need a multiple-
access protocol to coordinate access to the link.
Random Access Protocol
In random access or contention methods, no station is
superior to another station and none is assigned the
control over another.
No station permits, or does not permit, another station to
send.
At each instance, a station that has data to send uses a
procedure defined by the protocol to make a decision on
whether or not to send. This decision depends on the state
of the medium (idle or busy).
If more than one station tries to send, there is an access
conflict (collision) and the frames will be either destroyed
or modified.
Random Access Protocol
To avoid access conflict or to resolve it when it happens, each
station follows a procedure that answers the following
questions:
When can the station access the medium?
What can the station do if the medium is busy?
How can the station determine the success or failure of
the transmission?
What can the station do if there is an access conflict?
Random Access Protocol
ALOHA Protocol
ALOHA was the earliest random access method. There are
two types of ALOHA.
1. Pure ALOHA
2. Slotted ALOHA
Pure ALOHA
The original ALOHA protocol is called pure ALOHA. This is a
simple protocol.
Full form of ALOHA is Additive Links On-line Hawaii Area.
In this protocol each station sends a frame whenever it has
a frame to send. Since there is only one channel to share,
there is the possibility of collision between frames from
different stations.
Pure ALOHA
Following figure shows an example of frame collisions in pure
ALOHA.
Pure ALOHA
There are four stations that contend with one another for
access to the shared channel.
The figure shows that each station sends two frames;
there are a total of eight frames on the shared medium.
Some of these frames collide because multiple frames are
in contention for the shared channel.
Figure shows only two frames survive: frame 1.1 from
station 1 and frame 3.2 from station 3.
Pure ALOHA
The pure ALOHA protocol relies on acknowledgments from the
receiver. When a station sends a frame, it expects the receiver
to send an acknowledgment. If the acknowledgment does not
arrive after a time-out period, the station assumes that the
frame (or the acknowledgment) has been destroyed and
resends the frame.
A collision involves two or more stations. If all these stations
try to resend their frames after the time-out, the frames will
collide again. Pure ALOHA dictates that when the time-out
period passes, each station waits a random amount of time
before resending its frame. The randomness will help avoid
more collisions. We call this time the back-off time TB.
After a maximum number of retransmission attempts Kmax' a
station must give up and try later.
Pure ALOHA
Pure ALOHA
The time-out period is equal to the maximum possible round-
trip propagation delay i.e.
tout = 2Tp
Where Tp is the propagation time between two most widely
separated stations.
The back-off time TB is random value that normally depends on
K, where K is the number of attempted unsuccessful
transmissions.
TB is calculated by binary exponential back-off algorithm.
According to this algorithm, for each retransmission, a multiplier in
the range 0 to 2K - 1 is randomly chosen and multiplied by Tp
(maximum propagation time) or Tfr (the average time required to
send out a frame) to find TB.
In this procedure, the range of the random numbers increases
after each collision.
The value of Kmax is usually chosen as 15.
Pure ALOHA
Example: The stations on a wireless ALOHA network are a
maximum of 600 km apart. Signals propagate with speed at 3 x 108
m/s. Find the value of TB for different value of K.
Solution:
Tp = (600 x 103) / (3 x 108) = 2 ms.
Now we can find the value of TB for different values of K.
(a) For K = 1, the range is {0, 1}. The station needs to generate a
random number with a value of 0 or 1. This means that TB is either
0x2 = 0ms or 1x2 = 2ms, based on the outcome of the random
variable.
(b) For K =2, the range is {0, 1, 2, 3}. This means that TB can be 0, 2,
4, or 6 ms, based on the outcome of the random variable.
(c) For K =3, the range is to {0,1,2,3,4,5,6,7}. This means that TB can
be 0, 2, 4, ... , 14 ms, based on the outcome of the random
variable.
Pure ALOHA
Vulnerable time
Vulnerable time is the length of time, in which there is a possibility of collision.
We assume that the stations send fixed-length frames with each frame taking Tfr
second to send.
This figure shows the vulnerable time for station A.
Pure ALOHA vulnerable time = 2 x Tfr
Pure ALOHA
Throughput
Let G is the average number of frames generated by the
system during one frame transmission time.
Average number of successful transmissions for pure ALOHA
i.e. throughput, S = G x e-2G.
The maximum throughput
Smax = 0.184, for G = 1/2.
Pure ALOHA
Example:
A pure ALOHA network transmits 200-bit frames on a shared
channel of 200 kbps. What is the requirement to make this
frame collision-free?
Example:
A pure ALOHA network transmits 200-bit frames on a shared
channel of 200 kbps. What is the throughput if the system (all
stations together) produces
a. 1000 frames per second
b. 500 frames per second
c. 250 frames per second
Pure ALOHA
Solution:
Average frame transmission time Tfr = 200 bits/200 kbps
= 1 ms.
Therefore, the vulnerable time = 2 x Tfr = 2 ms
This means no station should send later than 1 ms before this
station starts transmission and no station should start sending
during the 1ms period that this station is sending.
Pure ALOHA
Solution:
Here, Tfr = 200/(200*10-3)= 1 ms
(a) Throughput S = G * e-2G
Here, G is the average number of frames generated in frame
transmission time.
G = 1000/1000 = 1 frame
S = 1*e-2*1 = e-2 = 0.135 (13.5 percent)
This means that the throughput is 1000 X 0.135 =135 frames.
Only 135 frames out of 1000 will probably survive.
Slotted ALOHA
Slotted ALOHA was invented to improve the efficiency of pure
ALOHA.
In slotted ALOHA we divide the time into slots of Tfr and force the
station to send only at the beginning of the time slot.
Figure shows an example of frame collisions in slotted ALOHA.
Slotted ALOHA
Since a station is allowed to send only at the beginning of
the synchronized time slot, if a station misses this
moment, it must wait until the beginning of the next time
slot.
There is still the possibility of collision if two stations try to
send at the beginning of the same time slot.
The vulnerable time is now reduced to one-half, equal to
Tfr.
Throughput, S = G*e-G
Maximum throughput Smax = 0.368, when G = 1.
Slotted ALOHA
Example:
A slotted ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second
b. 500 frames per second
c. 250 frames per second
Carrier Sense Multiple Access (CSMA)
To minimize the chance of collision and, therefore, increase the
performance, the CSMA method was developed.
Carrier sense multiple access (CSMA) requires that each station
first listen to the medium (or check the state of the medium)
before sending. In other words, CSMA is based on the principle
"sense before transmit" or "listen before talk.“
CSMA can reduce the possibility of collision, but it cannot
eliminate it.
The possibility of collision still exists because of propagation
delay; when a station sends a frame, it still takes time for the
first bit to reach every station and for every station to sense it.
In other words, a station may sense the medium and find it
idle, only because the first bit sent by another station has not
yet been received.
Carrier Sense Multiple Access (CSMA)
Carrier Sense Multiple Access (CSMA)
At time t1 station B senses the medium and finds it idle, so it
sends a frame. At time t2 (t2> t1) station C senses the medium
and finds it idle because, at this time, the first bits from
station B have not reached station C. Station C also sends a
frame. The two signals collide and both frames are destroyed.
Carrier Sense Multiple Access (CSMA)
Vulnerable Time
The vulnerable time for CSMA is the propagation time Tp .
This is the time needed for a signal to propagate from one
end of the medium to the other.
Carrier Sense Multiple Access (CSMA)
Persistence Methods
What should a station do if the channel is busy?
What should a station do if the channel is idle?
In this method, after the station finds the line idle, it sends
its frame immediately (with probability 1).
This method has the highest chance of collision because
two or more stations may find the line idle and send their
frames immediately.
Carrier Sense Multiple Access (CSMA)
Non-persistent
In the non-persistent method, a station that has a frame to send senses the
line. If the line is idle, it sends immediately. If the line is not idle, it waits a
random amount of time and then senses the line again.
The non-persistent approach reduces the chance of collision because it is
unlikely that two or more stations will wait the same amount of time and
retry to send simultaneously. However, this method reduces the efficiency
of the network because the medium remains idle when there may be
stations with frames to send.
Carrier Sense Multiple Access (CSMA)
p-Persistent
The data rate is 10 Mbps, the distance between station A and C is 2000 m, and
the propagation speed is 2 x 108 m/s. Station A starts sending a long frame at
time t1 = 0; station C starts sending a long frame at time t2 =3μs. The size of the
frame is long enough to guarantee the detection of collision by both stations.
Find:
a. The time when station C hears the collision (t3).
b. The time when station A hears the collision (t4).
c. The number of bits station A has sent before detecting the collision.
d. The number of bits station C has sent before detecting the collision.
IEEE 802 STANDARDS
IEEE 802 is a collection of networking standards that cover
the physical and data-link layer specifications for
technologies such as Ethernet and wireless. These
specifications apply to local area networks (LAN) and
metropolitan area networks (MAN).
IEEE stands for Institute of Electrical and Electronics
Engineers.
Ethernet(802.3 standard)
It uses CSMA/CD protocol to access the medium.
Frame Format
The Ethernet frame contains seven fields: preamble, SFD, DA,
SA, length or type of protocol data unit (PDU), upper-layer
data, and the CRC.
IEEE 802 STANDARDS
Preamble
This is the first field. It contains 7-bytes of alternating 0’s and
1’s that alerts the receiving system to the coming frame and
enables it to synchronize its input timing. The preamble is
actually added at the physical layer and is not part of the
frame.
IEEE 802 STANDARDS
Start frame delimiter (SFD)
The second field (1 byte: 10101011) signals the beginning of
the frame. The SFD warns the station or stations that this is
the last chance for synchronization. The last 2 bits is 11 and
alerts the receiver that the next field is the destination
address.
Destination address (DA)
The DA field is 6 bytes and contains the physical address of
the destination station or stations to receive the packet.
Source address (SA)
The SA field is also 6 bytes and contains the physical address
of the sender of the packet.
IEEE 802 STANDARDS
Length or type
This field is defined as a type field or length field. The original
Ethernet used this field as the type field to define the upper-
layer protocol using the MAC frame. The IEEE standard used it
as the length field to define the number of bytes in the data
field.
Data
This field carries data encapsulated from the upper-layer
protocols. It is a minimum of 46 and a maximum of 1500
bytes.
CRC
The last field contains error detection information. It is of 4
bytes.
IEEE 802 STANDARDS
Frame Length
Ethernet has imposed restrictions on both the minimum and
maximum lengths of a frame, as shown in below Figure:-
IEEE 802 STANDARDS
Addressing
Each station on an Ethernet network has its own network interface
card (NIC). The NIC fits inside the station and provides the station
with a 6-byte physical address. It is written in hexadecimal
notation, with a colon between the bytes.
06:01:02:01:2C:4B
Unicast, Multicast, and Broadcast Addresses
A source address is always a unicast address.
The destination address can be unicast, multicast, or broadcast.
If the least significant bit of the first byte in a destination address is
0, then the address is unicast; otherwise, it is multicast.
The broadcast address is a special case of the multicast address. In
this case, the recipients are all the stations on the LAN. A
broadcast destination address is forty eight 1’s.
IEEE 802 STANDARDS
Example
Define the type of the following destination addresses:
a) 4A:30:10:21:10:1A
b) 47:20:1B:2E:08:EE
c) FF:FF:FF:FF:FF:FF
IEEE 802 STANDARDS
IEEE 802.4 (Token Bus)
IEEE specifications include physical layer and media access
control sublayer for network that uses a bus topology and
use token passing as the media access method.
In this, all nodes are connected in a logical ring. It supports
electrical(coaxial) and fiber optic cable.
IEEE 802 STANDARDS
IEEE 802.5 (Token Ring)
A token ring network consists of a set of nodes connected
in a ring. Data always flows in a particular direction around
the ring.
It uses token passing as the media access method.
IEEE 802 STANDARDS
Fiber Distributed Data Interface(FDDI)
Fiber Distributed Data Interface (FDDI) is a set of ANSI and ISO
standards for transmission of data in local area network (LAN) over
fiber optic cables. It is applicable in large LANs that can extend up
to 200 kilometers in diameter.
Features
FDDI uses optical fiber as its physical medium.
It operates in the physical and medium access control (MAC
layer) of the Open Systems Interconnection (OSI) network
model.
It provides high data rate of 100 Mbps and can support
thousands of users.
It is used in LANs up to 200 kilometers for long distance voice
and multimedia communication.
IEEE 802 STANDARDS
It uses ring based token passing mechanism.
It contains two token rings, a primary ring for data and token
transmission and a secondary ring that provides backup if the
primary ring fails.
FDDI technology can also be used as a backbone for a wide area
network (WAN).
IEEE 802 STANDARDS
Frame Format
The frame format of FDDI is similar to that of token bus as
shown in the following diagram −
IEEE 802 STANDARDS
AKTU Examination Questions
1. A bit string 0001111111001111101000 needs to be
transmitted at the data link layer. What is the string
actually transmitted after bit stuffing?
2. Explain the working of pure ALOHA and slotted ALOHA
protocols. How slotted ALOHA improve the
performance of pure ALOHA?
3. List different carrier sense protocols. How CSMA/CD
protocol is different from other CSMA/CA protocol?
4. What is piggybacking?
5. Measurement of slotted ALOHA channel with infinite
number of users such that the 10 percent of slots are
idle.
(i) What is the channel load?
(ii) What is the throughput?
AKTU Examination Questions
6. If a binary signal is sent over a 3KHZ channel.
Whose signal to noise ratio is 20db. What is the
maximum achievable data rate?
7. Discuss the issues in the data link layer and about
its protocol on the basis of layering principle.
8. Discuss different carrier sense protocols. How are
they different than collisions protocols?
9. Write short notes on following:
i. Stop and Wait ARQ
ii. Sliding Window Protocol
iii. Go Back N ARQ
AKTU Examination Questions
10. An ALOHA network uses 9.2 kbps channel for sending
message packets of 100 bits long size. Calculate the
maximum throughput for pure ALOHA network.
11.What is the total delay (latency) for a frame size of 10
million bits that is being set up on link with 15 routers,
each having queuing time of 2μs and a processing
time of 1μs? The length of link is 3000km The speed of
light inside the link is 2x108 m/sec. The link has
bandwidth of 6 Mbps.
12.What is hamming code? Explain its working with
suitable example.
13.What are header and trailers and how do they get
added and removed?
AKTU Examination Questions
14. A large FDDI ring has 100 stations & a token rotation time of
40 msec. The token holding time is 10 msec. What is the
maximum achievable efficiency of the ring?
15. A channel has a bit rate of 20 kbps. The stop and wait
protocol with frame size 4500 bits is used. The delay for
error detection and sending ACK by the receiver is 0.25
seconds because of a fault. Find the maximum efficiency of
the channel if the destination is 30000 km away and the
speed of the propagation of the signal is 2.8X108 m/s. Find
the decrease in efficiency due to the fault.
16. A slotted ALOHA network transmits 400-bit frames on a
shared channel of 400 kbps. What is the throughput if the
system (all stations together) produces –
(i) 1000 frames per second
(ii) 500 frames per second
(iii) 250 frames per second
AKTU Examination Questions
17. Explain ARQ Error Control technique, in brief.
18. Compare ALOHA with slotted ALOHA.
19. State the requirements of CRC.
20.Discuss the issues in the data link layer and about its
protocol on the basis of layering principle.
21. Consider the use of 10 K-bit size frames on a 10 Mbps
satellite channel with 270 ms delay. What is the link
utilization for stop-and-wait ARQ technique assuming
P=10-3?
22.Brief about how line coding implemented in FDDI and
describe its format.
23.Illustrate the performance issues for GO-BACK-N data
link protocol.