Subject : Computer Networks - E

STUDY MATERIAL
Subject
Class
Unit
: Computer Networks.
: III year Computer Science
: III Unit
Syllabus :
Local and Metropolitan Area Network-Local area network protocols-Data
link layer design issues-Error detection and Correction.
LOCAL & METROPOLITAN AREA NETWORKS:
Lan has a sub layer called MAC which uses multiaccess channel for communication.
Multiaccess channels are actually the broad cast channels. The main features of LAN are
1) A diameter of not more than a few kilometers.
2) A total data rate of at least several Mbps
3) Complete ownership by a single organisation.
In contrast to the above WAN uses point-to-point links for communication.
WAN connects countries, their data rates is less than 1Mbps & they are owned by
multiple organisation. MAN is between LAN & WAN. The concepts applicable to LAN
is also applicable to MAN. Man uses digital transmission technology, and broad band
coaxial cables. WAN is always influenced by some legal, economic and some political
reasons. Error rates of WAN’s is 1000 times higher than that of LAN. The error
checking in LAN is done in higher layers only & hence lower layer protocols were
simpler and efficient.
STATIC CHANNEL ALLOCATION IN LAN’S AND MAN’S.
Allocation of a single channel to multiple uses is done with the help of FDM
(Frequency Division Multiplexing). The single channel is being divided into multiple
channels say N channels, and each of user, has their own channel for their transmissions.
FDM is very efficient in case of small & fixed number of users which have heavy local of
traffic. In case if the number of users is large then the allocated users then some of the
users will be denied permission since the bandwidth allocation would be over. Even if
some of the allocated band widths are not in use, they cannot be allocated to others. In
case the number of users are less than those allocated, then some of the channels would
be wasted. This is because of the static allocation. The performance of static allocation
is monitored using queing theory.
T = 1/UC- Where T is the time delay, is the arrival rate as frames/sec, & C is
the capacity of the channel & 1/u is the probability density function as bits/frame.
If the channel is divided into N independent sub channels, the capacity is given as C/N
bps & T is given as
Where T is N times worse then if all the frames were ordered.
The Synchronous TDM (Time Division Multiplexing) works in the same way as
the FDM. In case of ATDM, each terminal has a port inside the concentrator. Whenever
the terminals transmit, the data is stored into different memory in the concentrator & then
transmitted. In this case even if many terminals transmit at a time, there will not be
collision. But with dispersed users, a single channel is shared to communicate, & hence
there is collision there. Hence some other allocation method was to be chosen.
DYNAMIC CHANNEL ALLOCATION IN LAN & MAN:
There are some assumptions made in order to develop much better allocation methods.
They are given as follows.
1. Station Model.
Here there are N independent stations in which each user generates frames. After the
frame is generated, the station is blocked until that particular frame has been successfully
transmitted.
2. Single channel Assumption:
There is only one common channel in which all the stations transmit. All the stations are
considered equal as far as hardware is concerned. There are some software protocols
which allocate the priorities to the station.
3. Collision Assumption:
The overlapping of two frames transmitted simultaneously is called collision. The
collisions are detected by all stations and the collided frame must be retransmitted. Other
then collisions, there are no errors.
4. a) Continues Time:
Frame transmission can begin at any instant. There is no master clock dividing time into
discrete intervals.
b) Slotted Time: Time is divided into discrete intervals. Frame transmissions always
begin at the start of a slot. A slot may contain 0,1, or more frames, corresponding to an
idle slot a successful transmission, or a collision, respectively.
5 a) Carrier Sense: Stations call tell if the channel is in use before trying to use it. If the
channel is sensed as busy, no station will attempt to use it until it goes idle.
5 b) No Carrier Sense: Stations cannot sense the channel before trying to use it. They
just go ahead and transmit. Only later can they determine whether or not the transmission
was successful.
ALOHA PROTOCOLS:
These were developed by Norman Abramson to solve the channel allocation problem. It
was ground-based radio broadcasting.
Pure ALOHA and slotted ALOHA:
In ALOHA systems, the users send date as they have. There might be collisions of
frames and they will be destroyed. These destroyed frames are known by the feedback
property of broadcasting. The feedback of the satellite is delayed by 270m sec and the
that of LAN is immediate. The
Sender waits for a random time and even if no feedback is received, it retransmits the
frames. The waiting time is random so that collision of frames again can be avoided. The
process of multiple users using a single channel and leading to clashes is known as
Contention.
LAN PROTOCOLS:
Persistent and Non persistent CSMA:
There are some protocols called carrier sense protocols which give the position of
the stations. One of the carrier sense protocol is l – persistent CSMA ( Carrier Sense
Multiple Access). Each of the stations listen to this protocol and if some channel is idle
the stations starts transmitting, otherwise they wait for the channel to become idle & then
starts transmitting. Sometimes due to the propogation delay, some times there were
collisions. These collisions occur in cases like, when one station has transmitted and the
signal has not reached the other station, & other station transmites assuming that the
channel is idle. In case even if the propogation delay is zero, there will collisions
because two stations may transmit at the same time. The performance of this protocol is
much better than the pure ALOHA.
The next protocol is non-persistent CSMA. In this protocol, if a station wants to
transmit, it listens or senses the protocol, if the channel is busy, the station waits for a
random time and then starts transmitting.
In p-persistent CSMA, the station senses the channel, if it is idle the transmission
starts with a probability p and the next station with a probability q = l-p. If the channel is
busy, the station waits until it becomes free and applies the same principle again.
User
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
1
2
3
4
5
6
7
8
CSMA with Collision Detection:
Contention slots
To
t1
Frame
Frame
Contention
Interval
CSMA/CD in contention, transmission or idle.
Frame
Frame
idle
In this protocol, the station begins to transmit if the channel is idle if not it waits.
Suppose if the station detects a collision, the transmission is abruptly stopped. This saves
time and bandwidth by terminating the damaged frames. This is known as CSMA/CD.
Once a particular station transmission is over and the other stations detects a collision, it
waits for a random period of time and starts then transmission again. Hence there exits a
contention interval and an idle time. There is a necessity for contention algorithms. The
time taken by the station to realize the collision is equal to the length of the contention
period. Sometimes it might happen that a station might have transmitted before the signal
reaches that particular station. The transmission might be successful. The worst case
would be suppose the time for the signal to propagate is ‫ح‬. At time t0 one station begins
transmitting and at the interval ‫ح‬-ξ another station also starts transmitting then a collision
will be detected and transmission will be stopped at the time 2 ‫ح‬-ξ. If the station
transmitting does not hear any noise for 2 ‫ ح‬time, then the transmission is successful.
Collision detection is an analog process.
Collision free protocols:
In the previous algorithms like CSMA/CD, there are some collisions in the
contention period,. Hence some collision free protocols were developed. The first in the
list was called basic bit-map method. Here an assumption is made that there are N
stations each with an address from 0 to N-1. When a station wants to transmit data it
sends a 1 to the contention slot and a time slot is allocated. That time slot cannot be used
by any other station. Thus each station is allocated a time slot until one complete cycle is
over. Thus there will not be any collision even in the contention period. The performance
of this protocol is analyzed at two points as low numbered stations and high numbered
stations. The low numbered frames has to wait 1.5N slots for the transmission and high
numbered frames has to wait 0.5N slots. The overhead for N frames is d/(N+d) where d is
the amount of data. The overhead of 1 bit is d/(d+1) and the mean delay is equal to the
sum of the time it queues in the station plus the N(d+1)/2 for it to get to the head of the
queue once.
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6
7
1
1
1
1
3
7
1
1
1
5
1
BRAP :
BRAP was discovered by Chlamtac and Scholl as two versions namely BRAM
(Broadcast Recognition Access Method) and MSAP (Mini Slotted Alternating Protocol).
It was discovered in order to overcome the below mentioned disadvantage of basic bit
map protocol. The high numbered stations getting better service than lower numbered
ones. When the load is less, a station must wait for current scan to finish before they
transmit. In this protocol a transmission starts as soon as a 1 is inserted into the slot. The
next scan does not start from beginning but from the next station. The permission for the
slots is rotated among the stations. If a station wants to send, the permission is taken,
otherwise it is left for the other stations. The channel utilization is similar to basic bit map
method but its delay characteristics is better, i.e., each slot has to wait N/2 bit slots before
the transmission starts.
0 1
1
2 3
1
1
4 567
3
1
1
0 1
7
1
1
23 45
1
1
5
MLMA :
In order to improve the channel utilization under heavy load, this method was
devised. In this method we use radix method. Here the address of the station contains 3
bits. Each bit is represented using 10 bits known as a decade. When one station wants to
transmit, it uses a 30 bit header to transmit. The first decade of every slot is used to
represent the hundreds place of the stations address. The highest occupied bit in the first
decade is chosen and is known as x. Now the stations with x as the leading digit and the
highest occupied bit in the tens place is located as y. In the next decade the address with
xy as leading bits and the highest units place is located and this station gets a chance of
transmitting. An example is shown in the diagram below.
Among the five stations which wants to transmit i.e., 122, 125, 705, 722, 725, the stations
705, 722, and 725 gets the permission to transmit since x=7 here. In the second decade
the stations 722 and 725 gets preferences since y = 2. In the next decade only 725 gets
rights to transmit. Next comes 722 and then705 and so on. Here the channel efficiency
for minimum load is 30 bit header and is given as d/d+30. Under heavy load the
efficiency is d/d+1.11 for 1000 stations. The mean delay is less. The no.of levels for a
given r is the smallest value of l such that rl >= N.
9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1 0 1
0 0 0 0 1 0 0 1 0 0
Decade 0(122,125,705,722,725)
Decade 1 (705,722,725)
Decade 2 ( 722,725)
Decade 3 (705)
Decade 4 (122,125)
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 1 0 0
Adaptive tree walk protocol :
Tree for eight stations:
A
B
C
D
0
E
1
2
F
3
4
G
5
6
7
1. Here the stations were organized in the form of a binary tree.
2. During the first contention slot all the frames are permitted to try to acquire the
channel. If there are no collisions, the stations which acquired the slot transmits. If
collision occurs during the slot 1 only those stations falling under node B may
compete.
3. If one of them acquire the channel, then the stations under C can compete for the
channel.
4. If collision occurs then the stations under D will be given the next slot.
5. The tree is searched depth wise i.e., the left and the right children are searched. If
any one of them are ready, they transmit.
6. As the load becomes heavier the search begins father down the tree.
7. Each node at level I has a 2-I of the total tree below it. If level=2=>2-2=0.25.
8. If there are q ready stations which are uniformly distributed, the expected no.of
stations below a specific node at level I=2-iq
9. The optimal level to begin searching the tree is equal to the mean no.of stations
per slot i.e., 2-iq =1, log2q = 1( Solving the above equation).
Limited Contention Protocol :
1. This protocol combines two strategies namely contention and collision
free protocols.
2. The two important performance measures considered here are, delay at
low load and channel efficiency at high loads.
3. In contention protocols, at light loads, delay is low whereas at high loads
overhead increases.
4. In collision free protocols, at high loads there is high delay and at heavy
loads, the channel efficiency improves.
5. This protocol uses both the concepts. Here each station attempts to acquire
the channel with some probability, p with all the stations using the same p.
6. Performance is given as, the probability that some station successfully
acquires the channel during a given slot, for k stations with probability p is
= kp(1-p)k-1 .
7. Differentiating the above equation and substituting the value of p as i/k,
we get Pr(Success with optimal p) = k-1 k-1
k
From the graph, the probability of some stations acquiring the channel can
be increased only by decreasing the amount of competition. The concept of this protocol
is to divide the station into groups. Only members of a particular group are permitted to
compete for a particular slot. If one succeeds, it acquires the channel and transmits its
frames. If a collision occurs, the members of group 1 compete for slot 1. Because of the
groups among the stations, the contention for slots is reduced.
Data link Layer Design Issues :
1. It provides services to the network layer i.e., transferring data from the network
layer on the source machine to the network layer on the destination.
2. The diagram in figure (a) shows the virtual communication between the network
layers of source and destination. Figure (b) shows the actual communication with
the involvement of data link layer.
Virtual data path
7
6
5
4
3
2
1
Actual
Data
path
Figure (a)
Figure (b)
Actual communication
Virtual communication
There are three major services offered by data link layer. They are
1. Unacknowledged Connectionless Service
2. Acknowledged Connectionless Service
3. Connection Oriented Service
 In the first case no connection is established or released, and since there is no
acknowledgement the lost frames are not recovered.
 If the transmission is error free then this method is acceptable.
 In the second method again there is no connection established but each frame is
acknowledged.
 The third one is connection oriented method in which a physical connection is
established between the source and the destination and the frames sent are
received in the same order.
 In connection oriented service, there are three phases.
a) In the first phase a connection is established by initializing the variables and
counters as needed.
b) The second phase is the frame transmission phase.
c) In the third phase, the established connection is released, thus releasing the
variables and the buffers initialized in the first phase.
Request Confirm
Provider Service user
Network layer
Request
Indication Service
user
Service
Request
Indication
Data link layer
Physical layer
Confirm
Response
Framing:





The physical layer transmits the raw databit to the destination side. This
data is not ensured to be error free.
The data link layer has to take up the job of correcting or detecting the
errors.
In order to do that the data bit steam is split up into discrete frames with
the check bits.
The checksum is calculated before and after the transmission, if they are
different then an error is detected by the data link layer.
Splitting up of data bits into frames is carried out in order to enable the
data link layer to work easily. But this work is a very tedious job several
techniques are involved in the splitting up process they are,
1) Character count
2) Starting and ending characters, with character stuffing.
3) Starting and ending flags with bit stuffing
4) Physical layer coding violations.
Character Count:
In this method, a header which gives the number of frames is included. The data
link layer at the destination will know the number of characters transmitted. If the header
gets garbled during the transmission, the destination will get out of synchronization.
When a retransmission is requested, the point at which the retransmission should start is
not known. Hence there is no use of frames in this case.
Character count
5
1 2 3 4 5 6 7 8 9 8 0 1 2 3 4 5 6 9 7 8 9 0 1 2 3 4
Frame1
5 characters
Frame2
5 characters
Frame3
8 characters
Frame4
9 characters
Character Stream without errors
Error
5
1 2 3 4 7 6 7 8 9 8 0 1 2 3 4 5 6 9 7 8 9 0 1 2 3 4
Frame 1
Frame 2(Wrong)
Character with one error
Starting and ending characters, with character stuffing:


Each frame starts with an ASCII character sequence DLESTX and end the
sequence DLEETX.
Destination keeps track of the frame boundaries with DLESTX or DLEETX
characters.



The disadvantage is that the characters like DLE may occur accidentally in the
data which would interface with the framing.
In order to avoid this problem an extra DLE is added where ever an DLE is
encountered. This process is called Character Stuffing.
At the receiving end the data link layer destuffs the characters, i.e., where ever
there are two DLEs one of them is deleted.
DLE
DLE
A
ST
X
DLE
ST
X
DLE
A
B
DLE
DLE
DLE
ETX
B
DLE
DLE
ETX
Stuffed DLE
Bit Stuffing:




0
Each frame begins with a special bit pattern i.e., 01111110.
When the data link layer encounters a consecutive five ones, it inserts a zero
into the bit stream.
This phenomenoen is called the bit stuffing.
At the receiving end whenever the layer sees a five ones it destuffs the zeros
added. The example for bit stuffing is shown in the figure below.
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0
Data Bits without stuffing
0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0
Stuffed Bits
Error Control:



Flow Control:
If the sender keeps sending the frames without knowing if the receiver
has received it or not, then it is said to be connectionless service. In
connection-oriented services, an acknowledgement is expected to
ensure a reliable delivery of the data stream. This may be a positive or
negative acknowledgment. If it is positive then the frames has arrived
in a proper condition. If it is negative then there is some problem with
the transmission and retransmission is entertained.
If there is some hardware problem after the transmission started, and
the frame has not reached the destination, the sender will not be aware
of the problem and will be waiting for acknowledgment. This problem
is solved by having a timer, which is set immediately after
transmission is started. This makes the sender wait only for some time.
If the timer time is set out the waiting will be canceled.
Another problem is that if the timer runs out and if the
acknowledgment or the frame is lost a retransmission is carried out
and hence there is a chance of the receiver receiving duplicate frames.
In order to avoid that, the outgoing frames are given a sequence
number, so that the frames which are passed out is ensured to be
received only once.
Another design issue is that the sender wants to transmit the frames faster than the
receiver receives it. The sender keeps pumping out the frames before the receiver can
take up all the frames. In order to prevent this a flow control is introduced to coordinate
the fast sender to handle the traffic. A feedback is given to the sender about the situation
of the receiver. A set of rules is designed as protocol to control the transmission of
frames. The sender waits untill a permission is granted by the receiver asking the sender
to send the next frame.
Errors :
1. Transmission errors are due to the thermal noise because of the electrons moving
around in the copper wires.
2. Impulse noise is the major source of noise, and they have a duration of 10 msec.
3. The amplitude, propagation speed and phase of signals, depend on frequency.
4. The telephone system distorts the frequencies and joins them later. It is possible to
lease a separate line, but these lines are very costly.
5. Cross talk can occur between the wires placed side by side. Echo occurs when the
echo suppressor is turned off.
6. In order to have a linear amplitude, it is necessary to compress the voice signal
amplitude into a narrow range. This process is known as companding.
7. On PCM trunks the error occurs when the receiver is not in synchronization with
the transmitter.
8. Errors come as a burst than singly. Coming in burst has advantage i.e., since the
data is transmitted in terms of blocks the errors affect only one or two blocks. The
disadvantage is that, correcting block errors is difficult than correcting single
errors.
Two Basic strategy is followed to deal with the errors. One way is to include enough
redundant information along with each block of data sent to enable the receiver to deduce
what the transmitted information was.This strategy is called Error-Correcting Codes
The other way is to include only enough redundant information to allow the receiver to
deduce that an error has occurred but not which error and have it request a
retransmission. This strategy is called Error Detecting Codes
Normally a frame consists of m data bits and r check bits. Then the total length be
n=m+r bits. An n-bit unit containing data and check bits is often referred to as n- bit code
word.
Given any two codewords it is possible to determine how many corresponding bits
differ. To determine how many bits differ perform EX-OR operation and count the
number of 1 bits in the result The number of bit positions in which two codewords differ
is called Hamming distance.
Error Correction:
The error detecting and correcting properties of a code depend on its hamming distance.
To detect d errors a distance d+1 code is needed.
For example consider a code with m message and r check bits that will allow all single
errors to be corrected Each of the 2m legal messages has n illegal codewords at a distance
1 from it. Thus each of the 2m legal messages require n+1 bit patterns dedicated to it. The
bits of the codeword are numbered consecutively. starting with bit1 at the left end. The
bits that are powers of 2 are check bits. Each check bit forces the parity of some
collection of bits to be even or odd.
Ex:
Char
ASCII
Check bits
H
1001000
00110010000
The bit positions 1,2,8 are check bits. When a codeword arrives the receiver initializes a
counter to zero. It then examines each check bit k to see if it has correct parities. If not it
adds k to the counter. It the counter is zero after all the check bits are examined the
codeword is accepted as valid. If the counter is non zero it contains a incorrect bits. For
example if the check bits 1,2,8 are in error the inverted bit is 11, because it is the only
checked by bits 1,2 8. Hamming codes can correct errors. It can be also used to correct
burst errors. A Sequence of k consequtive codewords are arranged as a matrix one
codeword per row.To correct burst errors the data should be transmitted one column at a
time starting with the left most column. When the frame arrives at the receiver, the matrix
is reconstructed one column at a time. If a burst error of length k occurs, at most 1 bit in
each of k codeword will have been affected.
Error Detecting Codes:
Cyclic redundancy codes are used to detect errors. Polynomial codes are based upon
treating bit strings as representations of polynomials with coeffiecients of 0 and 1 only.
A k bit frame is regarded as the co efficient list of polynomials with k terms ranging from
xk-1 to x0.
When the polynomial code is employed, the sender and receiver must agree upon a
generator polynomial G(x) in advance. Both the high and low order bits of the generator
must be 1. To compute the check sum for some frame with m bits corresponding to the
polynomial M(x) the frame must be longer than the generator polynomial. The basic idea
is to append a check sum to the end of the frame in such a way that the polynomial
represented by the check summed frame is divisible.
If there is a remainder, there has been a transmission error.
The algorithm to compute the checksum is
1. Let r be the degree of G(x). Append r zero bits to the lower end of the frame, so it
now contains m+r bits
2. Divide the bit string corresponding to G(x) into the bit string corresponding to
xrM(x) using modulo 2 division.
3. Subtract the remainder from the bit string corresponding to xrM(x) using modulo
2 subtraction. The result is the checksummed frame to be transmitted.
Upon receiving the checksummed frame the receiver divides it by G(x) and it is always 0.
If there is a single bit errors E(x)=x i . where I determines which bit is in errors. If there
are an odd number of errors. E(X) contains an odd number of terms.
Suggested Questions.
Section – A
1.What is MAC
2.What are the characteristic features of LAN
3.What is MAN
4.What is WAN
5.Define the term FDM
6.Differentiate static and dynamic channel allocation
7.What is contention systems
8.What do you mean by CSMA
9.What is BRAP
10.What is MLMA
11.Differentiate connection oriented and connetionless service
12.What do you mean by character stuffing
13. What is companding
14. Define the term codeword
15. Define the term Hamming distance
Section – B
16.Write short notes on design issues of the data link layer
17.Write short notes on MAC layer
18.Write short notes on LAN, MAN and WAN
19.Write short notes on dynamic channel allocation model
20.Write short notes on collision free protocols
Section – C
21. Explain about LAN protocols
22. Explain about Aloha protocols.
23. Explain about Framing in data link layer protocol
Section- D
24. Explain in detail about Error detecting codes
25. Explain in detail about Error correction codes