0% found this document useful (0 votes)
27 views26 pages

Data Link Layer

Uploaded by

thirosul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views26 pages

Data Link Layer

Uploaded by

thirosul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

B.Sc.(E.C.S.

)-III

UNIT-IV
DATA LINK LAYER
Two machines are connected by a communication channel that acts
conceptually like a wire for effective communication between two adjacent
machine.

1.Data Link Layer Design Issues:-


The data link layer is designed to offer the
following functionalities.
1) Providing a well defined service interface to the network layer.
2) Dealing with transmission errors.
3) Regulating the flow of data so that slow receivers are not swamped by fast
senders.
The data link layer takes the packets it gets from network layer and
encapsulates them into frames for transmission. Each frame contains a frame
header, a payload field for holding packet and a frame trailer.

2.Data Link Layer Services:-


The data link layer offers following services:
1.Transmission of data :-
Data link layer provides services of transferring data from network layer no source
machine to the network layer on destination machine.
2.Frame synchronization:-
The source machine sends data in blocks called frames to destination machine.
The starting & ending of each frame recognized by the destination machine.
3.Flow control:-
The source machine must not send data frames at a rate faster than the
destination machine can accept them.
4.Error control:-
The error made in bits during transmission from source to destination machines
must be detected & corrected.
5.Addressing:-
On a multipoint line, like LAN, the identity of the individuals machines must be
specified while transmitting the data frames.
6.Control and data on the same link:-
The control and data bits is combined in a frame and then transmitted.
7.Link Management:-
The initiation, maintains and termination of link between the source and
destination is required for exchange of data.

P age |1
B.Sc.(E.C.S.)-III

3.Error detection and correction:-

3.1 Types of Errors


Single–Bit Error:-
The term single –bit error means that only one bit of
given data unit is changed from 1 to 0 or 0 to 1.

Figure

Burst Error :-
The term burst error means 2 or more than 2 bits in data
unit have changed from 0 to 1 or 1 to 0.
Figure

3.2Hamming Distance
The Hamming distance between two words (of the same size) is the number
of differences between the corresponding bits. 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. Note that the Hamming distance is a value greater than zero.
Example
Let us find the Hamming distance between two pairs of words.
1. The Hamming distance d(OOO, 011) is 2 because 000 + 011 is 011 (two 1s).
2. The Hamming distance d(10101, 11110) is 3 because 10101 + 11110 is 01011
(three 1s).
Minimum Hamming Distance : The minimum Hamming distance is the smallest
Hamming distance between all possible pairs in a set of words.

P age |2
B.Sc.(E.C.S.)-III

4.Error detection methods:-


There are 3 types of detection methods.
1.Parity check
2.Cyclic Redundancy check
3.Checksum

4.1Parity check:-
The most common and least expensive mechanism for error detection is
parity check.
Simple parity check:-
In this technique a redundant bit, called parity bit, is added to every data
unit so that the total number of 1’s in the unit (including parity bit) becomes even
(or odd).
Suppose we want to transmit data (binary data) unit 1100001.
Adding the number of 1’s gives us 3, an odd number. Before transmitting we
pass data unit through a parity generator. The parity generator counts 1’s &
appends the parity bit (a 1 in this case) to the end. The total no of 1’s is now 4, an
even no. The system now transmits the entire expanded unit across the network
link. When it reaches it’s destination, the receiver puts all 8 bits through an even
parity checking function. If receiver sees 11000011, it counts four 1’s, an even
number, & the data unit passes.
Ex: Suppose sender wants to send word world .In ASCII character coded as-
1110111 1101111 1110010 1101100 1100100
w o r l d
Each of 1st four characters has an even number of 1’s, so parity bit is a 0. The last
character (d), however, has three 1’s (an odd number), so parity bit is a 1 to make
total number of 1’s even. The following shows actual bits sent (parity bits are
underlined).
11101110 11011110 11100100 11011000 11001001

4.2Cyclic Redundancy check:-


The most powerful of redundancy checking techniques, is
Cyclic redundancy check (CRC).Unlike parity check, CRC is based on binary
division. Sequence of redundant bits, called CRC or CRC remainder, is appended
to end of data unit so that resulting data unit becomes exactly divisible by second,
predetermined binary number. At it’s destination, incoming data unit is divided by
same number. If at this step there is no remainder, the data unit is assumed to be
intact & is therefore accepted. A remainder indicates that the data unit has been
damaged in transit & therefore must be rejected.
To be valid, a CRC must have to qualities: It must have exactly
one less bit than divisor, & appending it to end of data string must make resulting
bit sequence exactly divisible by divisor .
First a string of ‘n’ 0’s is appended to data unit. The number ‘n’ is 1 less
than the number of bits in predetermined divisor, which is n+1 bits.
P age |3
B.Sc.(E.C.S.)-III

Second, newly elongated data unit is divided by divisor, using a process


called binary division. The resulting division is CRC.
Third, CRC of n bits derived in step 2 replaces appended 0’s at end of data
unit. Note that CRC may consist of all 0’s.
The data units arrives receiver data first, followed by CRC. The receiver
treats whole string as a unit & divides it by same divisor that was used to find
CRC remainder.
If string arrives without error, the CRC checker yields a remainder of zero &
data unit passes. If string has been changed in transit, the division yields a non-
zero remainder & data unit does not pass.

The CRC generator-


A CRC generator uses modulo-2 division.

Binary division by CRC generator

P age |4
B.Sc.(E.C.S.)-III

The CRC checker –


A CRC checker functions exactly as generator does.

Figure Binary division in CRC checker

4.3Checksum
The last error detection method is called as the checksum. The checksum is used
in the Internet by several protocols although not at the data link layer. The
checksum is based on the concept of redundancy.

Fig. Checksum

P age |5
B.Sc.(E.C.S.)-III

Internet Checksum
Traditionally, the Internet has been using a 16-bit checksum. The sender
calculates the checksum by following these steps.

Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to O.
3. All words including the checksum are added ushtg one's complement addition.
4. The sum is complemented and becomes the checksum.
5. The checksum is sent with the data.

The receiver uses the following steps for error detection.

Receiver site:
1. The message (including checksum) is divided into 16-bit words.
2. All words are added using one's complement addition.
3. The sum is complemented and becomes the new checksum.
4. If the value of checksum is 0, the message is accepted; otherwise, it is rejected.

e.g. Suppose the following block of 16 bits is to be sent using a checksum of 8


bits.
10101001 00111001
The numbers are added using one’s complement
10101001
00111001
------------
Sum 11100010
Checksum 00011101

The pattern sent is 10101001 00111001 00011101

Now suppose the receiver receives the pattern sent in Example 7 and there is no
error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s, which, after
complementing, is all 0s and shows that there is no error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is OK.
Now suppose there is a burst error of length 5 that affects 4 bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
P age |6
B.Sc.(E.C.S.)-III

10101111
11111001
00011101
Partial Sum 1 11000101
Carry 1
Sum 11000110
Complement 00111001 the pattern is corrupted.

5.Protocols:-

“ The protocol are normally implemented in software by using one of common


programming languages.”
They are of following types

Protocol

For Noiseless Channel for Noisy channel


Channel

1. Simplest 1.Stop & wait ARQ

2.Go Back N ARQ


2. Stop & wait
3.Selective Repeat ARQ
5.1Noiseless Channels :-
5.1.1.Simplest Protocols/Unrestricted simplex protocol :-
Simplest protocol has no flow & error control. It is a unidirectional protocol in
which data frames are travelling in only one direction- from sender to receiver. We
assume that receiver can immediately handle any frame, it receives with a
processing time that is small enough to be negligible. The data link layer of a
receiver immediately removes header from the frames & hands data packets to it’s
network layer which can also accept packets immediately, i.e. the receiver can
never be overwhelmed with incoming frames.
Design:-
There is no need for flow control in this scheme. The data link layer at
sender site gets data from it’s network layer, makes a frame out of data & sends it.
The data link layer at receiver site receives a frame from it’s physical layer,
extracts data from the frame, & delivers that data to it’s network layer.

P age |7
B.Sc.(E.C.S.)-III

Receiver
Sender

Get data Deliver data


Network
Network

Data link
Data link

Physical Send frame receiveframe


Physical
Data frames

Request from
network layer

Repeat forever Repeat forever


Algorithm for sender site Algorithm for receiver site

Event : Notification from

physical layer

Fig. The design of the simplest protocol with no flow or error control

The sender site can not send a frame until it’s network layer has a data packet to
send. The receiver site can not deliver data packet to it’s network layer until a
frame arrives. The procedure at sender site is constantly running there is no
action until there is a request from the network layer. The procedure at receiver is
also constantly running but there is no action till notification from physical layer
arrives.
Sender site algorithm for simplest protocol:
While (true) //Repeat forever
{
Wait for Event ( ); //sleep until event occur
if (Event (Request to send)) // packet to send
{
Get Data ( );
Make frame ( );
Send frame ( );
}
}
P age |8
B.Sc.(E.C.S.)-III

Receiver site algorithm for simplest protocol:


While (true) // Repeat forever
{
Wait for Event ( ); //sleep until event occurs
if (Event(Arrival Notification)) //Data frame arrived
{
Receiver frame ( );
Extract Data ( );
Deliver Data ( ); //Deliver data to network layer
}
}

5.1.2Simplex stop & wait protocols:-


If data frames arrives at the receiver site faster than they can be processed,
the frame must be stored until their use. Normally, the receiver does not have
enough storage space, especially if it is receiving data from many sources. This
may result in either the discarding of frames or denial of service. To prevent to
receiver from becoming over whelmed with frames, we somehow need to tell sender
to slow down. There must be feedback from the receiver to the sender.
The protocol is called as “stop & wait protocol” because sender sends one
frame, stops until it receives confirmation from receiver & then sends next frame.
We still have unidirectional communication from the other direction. We add flow
control to our previous protocol.
Design:-
We can see traffic on forward channel & the reverse channel. At any time,
there is either one data frame on forward channel or one ACK frame reserve
channel. So it needs a half-duplex link.
Sender site algorithm for stop & wait protocol
While (true) //Repeat forever
Cansend=true //Allow 1st frame to go
{
Wait for Event ( ); //wait until event occurs
if (Event (Request to send)AND cansend)
{
Get Data ( );
Make frame ( );
Send frame ( ); // send data frames
Cansend= false; // can’t send until ACK receives
}
Wait for Event( ); //sleep until an event occurs
If (Event(arrival notification))// An acknowledgment (ACK)arrived
{
Receive frame( ); // receive (ACK) frame
Cansend =true; } }
P age |9
B.Sc.(E.C.S.)-III

} Receiver
Sender
}
Receiver Deliver
Network site algorithm for stop-and-wait protocol
Get data
data Network
While (true)
{
Data link Wait for Event ( ); Data link
if (Arrival Notification)
{
Send Receive
Send Receive
Physical
frameReceiver
frame frame ( ); frame frame Physical
Data frame
Extract Data ( );
Deliver Data ( );
Ack frame
Send frame( );
}
Request from network layer
}

Repeat forever Repeat forever


Algorithm for sender site Algorithm for receiver site

Event : Notification from


Event : Notification from
physical layer
physical layer

Fig. Design of Stop-and- Wait Protocol

5.2 Noisy channel:-

5.2.1 Stop & wait Automatic Repeat Request (Simplex protocol for noisy
channel):-
Stop & wait ARQ adds a simple error control mechanism to stop & wait
protocol. To detect & correct corrupted frames, we need to add redundancy bits to
our data frame. When frame arrives at receiver site, it is checked & if it is
corrupted, it is silently discarded. The detection of errors in this protocol is
manifested by silence of receiver.
Lost frames are more difficult to handle corrupted ones. The received frame
could be correct one, or duplicate, or frame out of order. The solution is to number
frames. When receiver receives a data frame i.e. out of order, this means that
frames were either lost or duplicated.
The sender keeps copy of sent frame. At same time, it starts a timer. If the
timer expand & there is no ACK for sent frames, the frame is resent, the copy is
held, & timer is restarted. Since protocol uses stop & wait mechanism, there is

P a g e | 10
B.Sc.(E.C.S.)-III

only one specific frames that needs an ACK even though several copies of same
frame can be in network.
Since an ACK frame can also be corrupted & lost it too needs redundancy
bits & a sequence number. The ACK frame for this protocol has sequence number
field. In this protocol, sender simply discards a corrupted ACK frame or ignores an
out of order one.
In stop & wait ARQ, we use sequence numbers to number frames. The
sequence number are based on modulo-2 arithmetic.
In stop & wait ARQ, acknowledgment number always announces in modulo-
2 arithmetic. The sequence number of next frame expected.
Design:-
The sending device keeps a copy of last frame transmitted until it receives
an acknowledgment for that frame. A data frames uses a seq No; an ACK frame
uses an ackNo. The sender has a control variable, which we call Sn, that holds
sequence number for next frame to be sent (0 or 1).

Fig. (a)Normal operation (b) Stop-and-Wait ARQ, lost frame

5.2.2 Go-Back-N Automatic Repeat Request:-


In this protocol we can send several frames before receiving
acknowledgement, we keep a copy of these frames until acknowledgement arrives.
Sequence Number:-
Frames from sending stations are numbered sequentially. If header of frame
allows m bits for sequence number, they range from 2m -1.
In this protocol the sliding window is an abstract concept that defines range of
sequence number i.e. the concern of sender & receiver. In other words sender &
receiver need to deal with only part of possible sequence number. The range which

P a g e | 11
B.Sc.(E.C.S.)-III

is concern of sender is called Send sliding window. The range which is concern of
receiver is called Receive sliding window.

Fig. Go-Back-N ARQ, normal operation

The window at any time divides possible sequence number into four regions.
The first region, from far left wall of window, defines sequence numbers belonging
to frames that are already acknowledgement. The sender does not worry about
these frames & keeps no copies of them. The second region defines range of
sequence number belonging to the frames that are sent & have an unknown
status. The sender needs to wait to find out if these frames have been received or
were lost. The 3rd region defines range of sequence number for frames that can be
sent however the corresponding data packets have not yet been received from the
network layer. The fourth region defines sequence number that can’t be used until
window slides. How a send window can slide one or more slots to right when an
acknowledgement arrives from the other end. The receive window makes sure that
correct data frames are received & that correct acknowledgement are sent. The
size of receive window is always 1.
Timer:-
Although there can be a timer for each that is sent, in our protocol we use
only one.
Acknowledgement:-
The receiver sends a positive acknowledgement if a frame has arrived safe &
sound & in order. If a frame is damaged or is received out of order the receiver is
P a g e | 12
B.Sc.(E.C.S.)-III

silent & will discard all subsequent frames until it receives one it is expecting. The
silence of receiver causes timer of acknowledged frame at the sender site to expire.
This in turn, causes sender to go back and resend all frames, beginning with one
with expired timer. The receiver does not have to acknowledge each frame
received. It can send one cumulative acknowledgement for several frames.

5.2.3 Selective Repeat Automatic Repeat Request:


In noisy link a frame has a higher probability of damage, which means
resending of multiple frames. This resending uses up bandwidth & slows down the
transmission. For noisy links, there is another mechanism that does not resend N
frames when just one frame is damaged; only the damaged frames is resent. This
mechanism is called select Repeat ARQ. It is more efficient for noisy links, but
processing at receiver more complex.
Windows:-
The selective Repeat protocol also uses two window: a send window &
a receive window. However there are differences between windows in protocol &
the ones in Go-Back-N First, size of the send window is much smaller it is 2m-1.
Second receive window is same size as window i.e. send window. The smaller
window means less efficiency in filling the pipe, but fact that there are fewer
duplicate frames can compensate.
Figure

The receive window in selective Repeat is totally different from one in Go-
Back-N first size of receive window is same as size send window. The selective
Repeat protocol allows as many frames as a set of in-order frames to be delivered
to network layer. Because of size of send window & receive window are same , all
frames in send frames can arrive out of order & be stored until they can be
delivered. In selective Repeat ARQ size of send window & receive window must be
at most one half of 2m.

P a g e | 13
B.Sc.(E.C.S.)-III

Fig. Selective Repeat ARQ, lost frame

6 Hamming code:-
Hamming provides a practical solution. The hamming code can be applied to data
units of any length & uses relationship between data & redundancy bits.
Ex: 7 bit ASCII code requires 4 redundancy bits that can be added to end of data
units or interspersed with original data bits. In following fig. these bits are placed
in position 1,2,4 & 8. For clarity we refers to these bits are r1,r2,r4 & r8.

Fig. Positions of redundancy bits in Hamming code

In hamming code, each r bit is parity bit for one combination of data bits:
r1: bits 1,3,5,7,9,11
r2: bits 2,3,6,7,10,11
r3: bits 4,5,6,7
r4: bits 8,9,10,11
Each data bits may be included in more than one calculation. In sequence, each of
original data bits is included in at least two sets, while r-bits are included in only
one.

P a g e | 14
B.Sc.(E.C.S.)-III

Fig. Redundancy bits calculation

Calculating the r-values:-


The fig shows hamming code implementation on for as ASCII character. In
the 1 step, we place each bit of original character in it’s appropriate position in
st

11-bit unit. In subsequent steps. We calculate even parities for various


combination is value of corresponding r-bit.
Error detection and correction:-
Now imagine above transmission received the number 7 bit has changed
from 1 to 0. The receiver checks transmission & recalculates 3 new parity bits,
using same set of bits used by sender plus relevant parity r for each set. Then it
assembles new parity values into a binary number in order of position r (r4, r2, r1).
The binary no. received will show the location of bit in error.
Ex:- Given no. -1110101
7 6 5 4 3 2 1
1 1 1 0 1 0 1
Now we will perform check operation r1, r2, r4 etc. to get parity codes as-
Check 1-> 1, 3, 5, 7,….
Check 2-> 2, 3, 6, 7, 10, 11
Check 4-> 4, 5, 6, 7, 12, 13
Check 8-> 8, 9, 10, 11, 12
If the no. of 1’s in check 1st position are even the P1=0 otherwise P1=1
P1=0
Similarly P2=1
P4=1
Then we get error word as 1 1 0
P4 P2 P1

P a g e | 15
B.Sc.(E.C.S.)-III

Let’s find decimal equivalent for 110


(110)2=(6)10
Hence error is found at 6th bit. To correct error we have to invert the error bit (i.e.
6th position) i.e. corrupted bit.
Given code=1110101
Corrected code=1010101
7.Piggy Backing:-
In real life data frames are normally flowing in both directions from node A to B &
B to A so control information has to flow in both directions. A technique used to
increase (improve) efficiency of bidirectional protocol is “Piggy Backing”, when a
frame carrying data from A to B can also carry control information of arrived (or
lost) frames from B when a frame is carrying data from B to A, it can also carry
control information of arrived(or lost) frames from A.
Note each node now has two windows: one send window & one receive
window. Both also need to use timer. Both are involved in 3 types of events:
request, arrival, & time out. However arrival event is complicated when frame
arrives, site needs to handle control information as well as frame itself. Both of
these concerns must be taken care of in one event, the arrival event. The request
event uses only send window at each site, arrival window needs to use both
window.

8. Framing

The usual approach is for the data link layer to break the bit stream up into
discrete frames and compute the checksum for each frame. When a frame arrives
at the destination, the checksum is recomputed. If the newly-computed checksum
is different from the one contained in the frame, the data link layer knows that an
error has occurred and takes steps to deal with it

One way to achieve this framing is to insert time gaps between frames,
much like the spaces between words in ordinary text.
Four methods have been devised.
1. Character count.
2. Flag bytes with byte stuffing.
3. Starting and ending flags, with bit stuffing.
4. Physical layer coding violations.

1.The first framing method uses a field in the header to specify the number of
characters in the frame. When the data link layer at the destination sees the
character count, it knows how many characters follow and hence where the end of
the frame is. This technique is shown in Fig. for four frames of sizes 5, 5, 8, and 8
characters, respectively.

P a g e | 16
B.Sc.(E.C.S.)-III

Fig. A character stream. (a) Without errors. (b) With one error.

The trouble with this algorithm is that the count can be garbled by a
transmission error. For example, if the character count of 5 in the second frame of
Fig.(b) becomes a 7, the destination will get out of synchronization and will be
unable to locate the start of the next frame.

2. The second framing method gets around the problem of resynchronization after
an error by having each frame start and end with special bytes. Most protocols
have used the same byte, called a flag byte, as both the starting and ending
delimiter, as shown in Fig. (a) as FLAG. In this way, if the receiver ever loses
synchronization, it can just search for the flag byte to find the end of the current
frame. Two consecutive flag bytes indicate the end of one frame and start of the
next one.

Figure (a) A frame delimited by flag bytes. (b) Four examples of byte
sequences before and after byte stuffing.

A serious problem occurs with this method when binary data, such as object
programs or floating-point numbers, are being transmitted. It may easily happen
that the flag byte's bit pattern occurs in the data. This situation will usually
interfere with the framing. One way to solve this problem is to have the sender's
data link layer insert a special escape byte (ESC) just before each ''accidental'' flag
byte in the data. The data link layer on the receiving end removes the escape byte
before the data are given to the network layer. This technique is called byte
stuffing or character stuffing. Thus, a framing flag byte can be distinguished from
one in the data by the absence or presence of an escape byte before it.

P a g e | 17
B.Sc.(E.C.S.)-III

Disadvantage: -It is closely tied to the use of 8-bit characters.

Not all character codes use 8-bit characters. For example. UNICODE uses 16-bit
characters.

3.The new technique allows data frames to contain an arbitrary number of bits
and allows character codes with an arbitrary number of bits per character. It
works like this. Each frame begins and ends with a special bit pattern, 01111110
(in fact, a flag byte). Whenever the sender's data link layer encounters five
consecutive 1s in the data, it automatically stuffs a 0 bit into the outgoing bit
stream. This bit stuffing is analogous to byte stuffing, in which an escape byte is
stuffed into the outgoing character stream before a flag byte in the data.

When the receiver sees five consecutive incoming 1 bits, followed by a 0 bit, it
automatically destuffs (i.e., deletes) the 0 bit. Just as byte stuffing is completely
transparent to the network layer in both computers, so is bit stuffing. If the user
data contain the flag pattern, 01111110, this flag is transmitted as 011111010
but stored in the receiver's memory as 01111110. Figure gives an example of bit
stuffing.

Figure. Bit stuffing. (a) The original data. (b) The data as they appear on the
line. (c) The data as they are stored in the receiver's memory after destuffing.

4.The last method of framing is only applicable to networks in which the encoding
on the physical medium contains some redundancy. For example, some LANs
encode 1 bit of data by using 2 physical bits. Normally, a 1 bit is a high-low pair
and a 0 bit is a low-high pair. The scheme means that every data bit has a
transition in the middle, making it easy for the receiver to locate the bit
boundaries. The combinations high-high and low-low are not used for data but are
used for delimiting frames in some protocols.

9.Random Access :
In random access or contention methods, no station is superior to another
station &name 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.
Two features give this method its name. First , there is no scheduled time for
a station to transmit. Transmission is random among the stations. That is only
these methods are called random access. Second, no rules specify which station

P a g e | 18
B.Sc.(E.C.S.)-III

should send next. Stations compete with one another to access the medium.
That’s why these methods are also called contention methods.
9.1 ALOHA :-
ALOHA, the earliest random access method, was developed at university of
Hawaii in early 1970.It is obvious that there are potential collisions in this
arrangement. The medium is shared between the stations.
When a station sends data, another station may attempt to do so at the
same time. The data from the two stations collide and become garbled.
9.1.1Pure ALOHA :-
The original ALOHA protocol is called as ‘Pure ALOHA’. This is simple but
elegant protocol. The idea is that each station sends a frame whenever it has a
frame to send. However, since there is only one channel to share, there is the
possibility of collision between frames frame different stations.
Following fig. shows an Example of frame collisions in Pure ALOHA.
There are 4 stations that contend with one another for access to the shared
channel. The fig. shows that each station sends two frames, there are total of eight
frames on the shared medium. Some of these frames collide because multiple
frames are in contention for the shared channel. We need to mention that even if
one bit of a frame coexists on the channel with one bit from another frame, there
is a collision & both will be destroyed.

Fig . Pure ALOHA

It is obvious that we need to resend the frames that have been destroyed
during transmission. 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 an acknowledgment does not arrive after a time-out period,
the station assumes that the frame has been destroyed & resends the frame.
A collision involves two or more stations. If all the stations try to resend
there frames after the time-out, the frames will collide again. Pure ALOHA dictates
that when time-out period passes, each station waits a random amount of time
before resending its frame.

P a g e | 19
B.Sc.(E.C.S.)-III

Vulnerable Time:-
The length of time, the vulnerable time, in which there is a possibility of
collision. We assume that the stations send fixed length frames with each frame
taking Tfrs. to send.
The vulnerable time, during which a collision may occur in pure ALOHA, is
2 times the frame transmission time.
Pure ALOHA vulnerable time = 2 x Tfr.
Throughput:-
Let us call G the average No. of frames generated by the system during 1 Frame
transmission time. Then it can be proved that the average of no. of successful
transmissions for pure ALOHA is
S=G x e^-2G.
Maximum throughput S max is 0.184, for G=1/2.
In other words, if 1/2 a frame is generated during one frame transmission time,
then 18.4 % of these frames reach their destination successfully. Therefore, if a
station generate only one frame in this vulnerable time, the frame will reach its
destination successfully.

9.1.2 Slotted ALOHA:-


Slotted ALOHA was invented to improve the efficiency of pure ALOHA.
In ‘ slotted ALOHA ‘ we divide the time into slots of Tfr & force the station to
send only at the beginning of the time slot. fig. shows an example of frame
collisions in slotted ALOHA.
Figure:-

Because 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. This means that the station which started at the
beginning of this slot has already finished sending its frame. Of course, there is
still the possibility of collision if two stations try to send at the beginning of the
same time slot. However, the vulnerable time is now reduced to one-half, equal to
Tfr.

Throughput:-
It can be proved that the average no.of successful transmissions for slotted
ALOHA is, S=G X e^-G.
P a g e | 20
B.Sc.(E.C.S.)-III

Maximum throughput Smax is 0.368, when G=1.


In other words, if a frame is generated during one frame transmission time,
then 36.8% of these frames reach their destination successfully.
Therefore, if a station generates only one frame in this vulnerable time, the frame
will reach its destination successfully.

9.2Carrier Sense Multiple Access (CSMA):-


To minimize the chance of collision & therefore, increase the performance,
the CSMA method was developed. The chance of collision can be reduced if a
station senses the medium before trying to use it.
CSMA requires that each station first listen to the medium before sending
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
reason for this is a space & time model of CSMA network. Stations are connected
to a shared channel.
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 & for
every station to sense it. In other words, a station may sense the medium & find it
idle, only because the first bit sent by another station has not yet been received.

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. When a
station sends a frame, & any other station tries to send a frame during this time, a
collision will result. But if the first bit of the frame reaches the end of the medium,
every station will already have heard the bit & will refrain from sending.
Persistence Methods:-
What should a station do if the channel is busy? What should a station do if
the channel is idle? Three methods have been devised to answer these questions :
The one –persistent method, the non-persistent method & p-persistent method.
Fig. shows behavior of 3 persistence methods when a station finds a channel busy.
Behavior of 3 persistence methods:-
Figure:-

P a g e | 21
B.Sc.(E.C.S.)-III

1.1-persistent method:-
The 1-persistence method is simple & straight forward. In this method, after
the station finds the line idle, it sends its frame immediately. This method has the
highest chance of collision because 2 or more stations may find the line idle &
send their frames immediately.
2.Non-persistent method:-
In this 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 & then senses the line again. The non-persistent approach reduces the
chance of collision because it is unlikely that two or more station will wait the
same amount of time & 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.
3.P-persistent method:-
This method is used if the channel has time slots with aslot duration equal
to or greater than the maximum propagation time. The p-persistent approach
combines the advantages of the other two strategies. It reduces the chance of
collision & improves efficiency. In this method, after the station finds the line idle
it follows these steps:
1. With probability p, the station sends its frame.
2. With probability q=1-p, the station waits for the beginning of the next time
slots & checks the line again.
a. If the line is idle, it goes to step 1.
b. If the line is busy, it acts as though a collision has occurred & uses the
back-off procedure.

P a g e | 22
B.Sc.(E.C.S.)-III

9.3Carrier Sense Multiple Access with Collision Detection (CSMA/CD):-


Carrier sense multiple access with collision detection (CSMA/CD) augments
the algorithm to handle the collision.
In this method, a station monitors the medium after it sends a frame to see
if the transmission was successful. If so, the station is finished. If, however, there
is a collision the frame is sent again.
Let’s look at the first bits transmitted by the 2 stations involved in the collision.
Although each station continues to send bits in the frame until it detects the
collision, we show what happens as the first bits collide.
Figure:-

At time t1, station A has executed its persistence procedure & starts sending
the bits of its frame. At time t2, station C has not yet sensed the first bit sent by A.
Station C executes its persistence procedure & starts sending the bits in its frame,
which propagate both to the left & to the right. Collision occurs sometime after
time t2. Station C detects a collision at time t3 when it receives the first bit of A’s
frame. Station C immediately aborts transmission. Station A detects collision at
time t4 when it receives the first bit of C’s frame, it also immediately transmission.
Minimum frame size:-
For CSMA/CD to work, we need a restriction on the frame size. Before sending the
last bit of the frame, the sending station must detect a collision, if any, & abort the
transmission. This is so because the station, once the entire frame is send does
not keep a copy of the frame & does not monitor the line for the collision detection.
Procedure:-
The first difference is the addition of the persistence process. We need to sense the
channel before we start sending the frame by using one of the persistence
processes we discussed ( non- persistent, 1-persistent , p-persistent ).

P a g e | 23
B.Sc.(E.C.S.)-III

The second difference is the frame transmission. In ALOHA, we first transmit the
entire frame & then wait for an acknowledgment. In CSMA/CD, transmission &
collision detection is a continuous process. We do not send the entire frame &
then look for a collision. The station transmits & receives continuously &
simultaneously. When we come out of the loop, if a collision has not been
detected, it means that transmission is complete; the entire frame is transmitted.
Otherwise, a collision has occurred.
The third difference is the sending of a short ‘jamming signal’ that enforces
the collision in case other stations have not yet sensed the collision.
Energy Level:-
We can say that the level of energy in a channel can have three values: zero,
normal & abnormal. At the zero level, the channel is idle. At the normal level, a
station has successfully captured the channel & is sending its frame. At the
abnormal level, there is collision & the level of the energy is twice the abnormal
level.
Throughput:-
The throughput of CSMA/CD is greater than that of pure or slotted ALOHA.
Maximum throughput occurs at a different value of G & is based on the
persistence method & value of P in the persistence method & value of P in the p-
persistent approach.

P a g e | 24
B.Sc.(E.C.S.)-III

10 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. There are three channelization protocols: FDMA, TDMA, and
CDMA.
10.1Frequency-Division Multiple Access (FDMA)
In frequency-division multiple access (FDMA), the available bandwidth is
divided into frequency bands. Each station is allocated a band to send its data. In
other words, each band is reserved for a specific station, and it belongs to the
station all the time. Each station also uses a band pass filter to confine the
transmitter frequencies. To prevent station interferences, the allocated bands are
separated from one another by small guard bands.
FDMA specifies a predetermined frequency band for the entire period of
communication.
FDMA is an access method in the data link layer. The data link layer in each
station tells its physical layer to make a bandpass signal from the data passed to
it. The signal must be created in the allocated band. There is no physical
multiplexer at the physical layer. The signals created at each station are
automatically bandpass-filtered. They are mixed when they are sent to the
common channel.

10.2 Time-Division Multiple Access (TDMA)


In time-division multiple access (TDMA), the stations share the bandwidth of
the channel in time. Each station is allocated a time slot during which it can send
data.Each station transmits its data in is assigned time slot.
The main problem with TDMA lies in achieving synchronization between the
different stations. Each station needs to know the beginning of its slot and the
location of its slot. This may be difficult because of propagation delays introduced
in the system if the stations are spread over a large area. To compensate for the
delays, we can insert guard times. Synchronization is normally accomplished by
having some synchronization bits (normally referred to as preamble bits) at the
beginning of each slot.
TDMA, on the other hand, is an access method in the data link layer. The
data link layer in each station tells its physical layer to use the allocated time slot.
There is no physical multiplexer at the physical layer.

10.3 Code-Division Multiple Access (CDMA)


Code-division multiple access (CDMA) was conceived several decades ago. Recent
advances in electronic technology have finally made its implementation possible.
CDMA differs from FDMA because only one channel occupies the entire bandwidth
of the link. It differs from TDMA because all stations can send data
simultaneously; there is no timesharing.

Idea
P a g e | 25
B.Sc.(E.C.S.)-III

Let us assume we have four stations 1, 2, 3, and 4 connected to the same channel.
The data from station 1 are dl , from station 2 are d2, and so on. The code
assigned to the first station is c1, to the second is c2, and so on. We assume that
the assigned codes have two properties.
1. If we multiply each code by another, we get O.
2. If we multiply each code by itself, we get 4 (the number of stations).
With these two properties in mind, let us see how the above four stations can send
data using the same common channel.
Station 1 multiplies (a special kind of multiplication, as we will see) its data by its
code to get d l.c1
Station 2 multiplies its data by its code to get d2 . c2 And so on. The data that go
on the channel are the sum of all these terms, as shown in the box. Any station
that wants to receive data from one of the other three multiplies the data on the
channel by the code of the sender.

P a g e | 26

You might also like