0% found this document useful (0 votes)
45 views22 pages

4th Sem CN Unit 3

The document discusses the data link layer and its key functions and design issues. It describes types of errors like single-bit and burst errors. It also covers framing techniques used to separate frames like character counting, flag bytes with byte stuffing, and starting/ending flags with bit stuffing.

Uploaded by

Shagun Pandey
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)
45 views22 pages

4th Sem CN Unit 3

The document discusses the data link layer and its key functions and design issues. It describes types of errors like single-bit and burst errors. It also covers framing techniques used to separate frames like character counting, flag bytes with byte stuffing, and starting/ending flags with bit stuffing.

Uploaded by

Shagun Pandey
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/ 22

Priyadarshini Bhagwati College of Engineering, Nagpur

Department of Computer Science & Engineering


B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
UNIT - 3
DATA LINK LAYER

CONTENTS – Types of errors, framing (character and bit stuffing), Protocols: for Noiseless
Channels (Simplex, Stop and Wait), for Noisy Channels (Stop & wait ARQ, Go-Back- N ARQ,
Selective repeat ARQ), Point to Point (PPP), Multiple Access Protocol: Pure Aloha, Slotted
Aloha, CSMA, CSMA/CD, CSMA/CA.

DATA LINK LAYER –


• The main task of the data link layer is to transform a raw transmission facility into a
line that appears free of undetected transmission errors to the network layer.
• It accomplishes this task by having the sender break up the input data into data frames
(typically a few hundred or a few thousand bytes) and transmits the frames
sequentially.
• If the service is reliable, the receiver confirms correct receipt of each frame by sending
back an acknowledgement frame.
• Another issue that arises in the data link layer (and most of the higher layers as well)
is how to keep a fast transmitter from drowning a slow receiver in data.
• Some traffic regulation mechanism is often needed to let the transmitter know how
much buffer space the receiver has at the moment. Frequently, this flow regulation and
the error handling are integrated.

Data Link Layer Design Issues –


• Data-link layer takes packets from Network Layer and encapsulates them into Frames.
Then, it sends each frame bit-by-bit on the hardware.
• At receiver’ end, data link layer picks up signals from hardware and assembles them
into frames.
• The data link layer divides the stream of bits received from the network layer into
manageable data units called frames.

Fig – Relationship between Packet & Frame

Types of Errors
• Whenever bits flow from one point to another, they are subject to unpredictable
changes because of interference. This interference can change the shape of the signal.
In a single-bit error, a 0 is changed to a 1 or a 1 to a 0. In a burst error, multiple bits are
changed.

UNIT 3 – DATA LINK LAYER Page 1


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
• For example, a 11100 s burst of impulse noise on a transmission with a data rate of
1200 bps might change all or some of the12 bits of information.
1) Single-Bit Error- The term single-bit error means that only 1 bit of a given data unit
(such as a byte, character, or packet) is changed from 1 to 0 or from 0 to 1. In a single-
bit error, only 1 bit in the data unit has changed.

Single-bit errors are the least likely type of error in serial data transmission. To
understand why, imagine data sent at 1 Mbps. This means that each bit lasts only
1/1,000,000 s, or 1) ls. For a single-bit error to occur, the noise must have a duration
of only 1) ls, which is very rare; noise normally lasts much longer than this.

2) Burst Error- The term burst error means that 2 or more bits in the data unit have
changed from 1 to 0 or from 0 to 1. A burst error means that 2 or more bits in the data
unit have changed.

Figure shows the effect of a burst error on a data unit. In this case,
0100010001000011 was sent, but 0101110101100011 was received. Note that a
burst error does not necessarily mean that the errors occur in consecutive bits. The
length of the burst is measured from the first corrupted bit to the last corrupted bit.
Some bits in between may not have been corrupted. A burst error is more likely to
occur than a single-bit error. The duration of noise is normally longer than the
duration of 1 bit, which means that when noise affects data, it affects a set of bits. The
number of bits affected depends on the data rate and duration of noise. For example, if
we are sending data at 1 kbps, a noise of 11100 s can affect 10 bits; if we are sending
data at 1 Mbps, the same noise can affect 10,000 bits.

FRAMING –

• Framing in the data link layer separates a message from one source to a destination,
or from other messages to other destinations, by adding a sender address and a
destination address.
• The destination address defines where the packet is to go; the sender address helps
the recipient acknowledge the receipt. Although the whole message could be packed in
one frame, which is not normally done.
UNIT 3 – DATA LINK LAYER Page 2
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
• One reason is that a frame can be very large, making flow and error control very
inefficient. When a message is carried in one very large frame, even a single-bit error
would require the retransmission of the whole message. When a message is divided
into smaller frames, a single-bit error affects only that small frame.
• Breaking the bit stream up into frames is more difficult than it at first appears. One
way to achieve this framing is to insert time gaps between frames, much like the
spaces between words in ordinary text.
• However, networks rarely make any guarantees about timing, so it is possible these
gaps might be squeezed out or other gaps might be inserted during transmission.
• Since it is too risky to count on timing to mark the start and end of each frame, other
methods have been devised.
• Following methods are used for carrying methods:
i. Character count.
ii. Flag bytes with byte stuffing.
iii. Starting and ending flags, with bit stuffing.

i. Character count
• 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. A for four frames of sizes 5, 5, 8, and 8 characters,
respectively.

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.
• Even if the checksum is incorrect so the destination knows that the frame is bad, it still
has no way of telling where the next frame starts.
• Sending a frame back to the source asking for a retransmission does not help either,
since the destination does not know how many characters to skip over to get to the
start of the retransmission. For this reason, the character count method is rarely used
anymore.

UNIT 3 – DATA LINK LAYER Page 3


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
ii. Character stuffing (Flag bytes with byte stuffing)
• In the second method, each frame starts with the ASCII character sequence DLE STX
and ends with the sequence DLE ETX.(where DLE is Data Link Escape, STX is Start of
Text and ETX is End of Text.)
• This method overcomes the drawbacks of the character count method. If the
destination ever loses synchronization, it only has to look for DLE STX and DLE ETX
characters. If however, binary data is being transmitted then there exists a possibility
of the characters DLE STX and DLE ETX occurring in the data.
• Since this can interfere with the framing, a technique called character stuffing is used.
The sender’s data link layer inserts an ASCII DLE character just before the DLE
character in the data.
• The receiver’s data link layer removes this DLE before this data is given to the network
layer.
• However character stuffing is closely associated with 8-bit characters and this is a
major hurdle in transmitting arbitrary sized characters.

Fig- Character stuffing


iii. Bit stuffing
• The third method allows data frames to contain an arbitrary number of bits and allows
character codes with an arbitrary number of bits per character.
• At the start and end of each frame is a flag byte consisting of the special bit pattern
01111110.
• Whenever the sender’s data link layer encounters five consecutive 1’s in the data, it
automatically stuffs a zero bit into the outgoing bit stream.
• This technique is called bit stuffing. When the receiver sees five consecutive 1s in the
incoming data stream, followed by a zero bit, it automatically neighbors the 0 bit.
• The boundary between two frames can be determined by locating the flag pattern.

Fig- Bit Stuffing

UNIT 3 – DATA LINK LAYER Page 4


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
DATA LINK PROTOCOLS
• All the protocols are unidirectional in the sense that the data frames travel from one node,
called the sender, to another node, called the receiver.
• Although special frames, called acknowledgment (ACK) and negative acknowledgment
(NAK) can flow in the opposite direction for flow and error control purposes, data flow in
only one direction. In a real-life network, the data link protocols are implemented as
bidirectional; data flow in both directions.
• In these protocols the flow and error control information such as ACKs and NAKs is
included in the data frames in a technique called piggybacking. Because bidirectional
protocols are more complex than unidirectional ones.
• The protocols in the first category cannot be used in real life, but they serve as a basis for
understanding the protocols of noisy channels. Figure shows the classifications.
• Because of the possibility of transmission errors, and because the receiver of data may
need to regulate the rate at which data arrive, synchronization and interfacing techniques
are insufficient by themselves.
• It is necessary to impose a layer of control in each communicating device that provides
functions such as flow control, error detection, and error control. This layer of control is
known as a data link control protocol.
• Flow control enables a receiver to regulate the flow of data from a sender so that the
receiver’s buffers do not overflow.
• In a data link control protocol, error control is achieved by retransmission of damaged
frames that have not been acknowledged or for which the other side requests a
retransmission.

UNIT 3 – DATA LINK LAYER Page 5


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
PROTOCOLS FOR NOISELESS CHANNELS
1. Simplest Protocol
• It is Simple Connectionless Protocol and has no flow or error control. It is a
unidirectional protocol in which data frames are traveling in only one direction-from
the sender to receiver.
• The data link layer of the receiver immediately removes the header from the frame
and hands the data packet to its network layer, which can also accept the packet
immediately.
• The sender site cannot send a frame until its network layer has a data packet to send.
The receiver site cannot deliver a data packet to its network layer until a frame arrives.

Figure1 - The design of the simplest protocol with no flow or error control

• If the protocol is implemented as a procedure, we need to introduce the idea of events


in the protocol. The procedure at the sender site is constantly running; there is no
action until there is a request from the network layer. The procedure at the receiver
site is also constantly running, but there is no action until notification from the
physical layer arrives.
• It is very simple. The sender sends a sequence of frames without even thinking
about the receiver. To send three frames, three events occur at the sender site
and three events at the receiver site. Note that the data frames are shown by
tilted boxes; the height of the box defines the transmission time difference
between the first bit and the last bit in the frame.

UNIT 3 – DATA LINK LAYER Page 6


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

Figure2-Flow Diagram

2. Stop and Wait Protocol


• If data frames arrive at the receiver site faster than they can be processed, the frames
must be stored until their use.
• In Stop-and-Wait Protocol the sender sends one frame, stops until it receives
confirmation from the receiver (okay to go ahead), and then sends the next frame.

Figure3 - Design of Stop-and-Wait Protocol

• Comparing this figure3 with Figure1, we can see the traffic on the forward channel
(from sender to receiver) and the reverse channel. At any time, there is either one data
frame on the forward channel or one ACK frame on the reverse channel. We therefore
need a half-duplex link.
• Figure4 shows an example of communication using this protocol. It is still
very simple. The sender sends one frame and waits for feedback from the
receiver. When the ACK arrives, the sender sends the next frame. Note that
UNIT 3 – DATA LINK LAYER Page 7
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
sending two frames in the protocol involves the sender in four events and the
receiver in two events.

Fig4- Flow Diagram

PROTOCOLS FOR NOISY CHANNELS


1. Stop-and-Wait Automatic Repeat Request
• Stop-and-Wait Automatic Repeat Request (Stop-and Wait ARQ), adds a simple error
control mechanism to the Stop-and-Wait Protocol. Let us see how this protocol detects
and corrects errors.
• To detect and correct corrupted frames, we need to add redundancy bits to our data
frame. When the frame arrives at the receiver site, it is checked and if it is corrupted, it
is silently discarded. The detection of errors in this protocol is manifested by the
silence of the receiver.
• Lost frames are more difficult to handle than corrupted ones. In our previous
protocols, there was no way to identify a frame. The received frame could be the
correct one, or a duplicate, or a frame out of order. The solution is to number the
frames.
• When the receiver receives a data frame that is out of order, this means that frames
were either lost or duplicated. The completed lost frames need to be resent in this
protocol. If the receiver does not respond when there is an error, how can the sender
know which frame to resend?
• To remedy this problem, the sender keeps a copy of the sent frame. At the same time, it
starts a timer. If the timer expires and there is no ACK for the sent frame, the frame is
resent, the copy is held, and the timer is restarted.
• Since the protocol uses the stop-and-wait mechanism, there is only one specific frame
that needs an ACK even though several copies of the same frame can be in the network.
• Since an ACK frame can also be corrupted and lost, it too needs redundancy bits and a
sequence number. The ACK frame for this protocol has a sequence number field. In this
protocol, the sender simply discards a corrupted ACK frame or ignores an out-of-order
one.
UNIT 3 – DATA LINK LAYER Page 8
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

Fig- working of Stop-and-Wait Automatic Repeat Request

2. Go-Back-N Automatic Repeat Request


• To improve the efficiency of transmission (filling the pipe), multiple frames must be in
transition while waiting for acknowledgment. In other words, we need to let more
than one frame be outstanding to keep the channel busy while the sender is waiting for
acknowledgment.
• The first is called Go-Back-N Automatic Repeat Request (the rationale for the name
will become clear later).
• In this protocol, send several frames before receiving acknowledgments; keep a copy
of these frames until the acknowledgments arrive.
• Frames from a sending station are numbered sequentially. However, because we need
to include the sequence number of each frame in the header, we need to set a limit.
• If the header of the frame allows m bits for the sequence number, the sequence
numbers range from 0 to 2m – 1. For example, if m is 4, the only sequence numbers are
0 through 15 inclusive.
• However, we can repeat the sequence. So, the sequence numbers are 0, 1,2,3,4,5,6,
7,8,9, 10, 11, 12, 13, 14, 15,0, 1,2,3,4,5,6,7,8,9,10, 11, ... In other words, the sequence
numbers are modulo-2m.
• In this protocol (and the next), the sliding window is an abstract concept that defines
the range of sequence numbers that is the concern of the sender and receiver.
• In other words, the sender and receiver need to deal with only part of the possible
sequence numbers. The range which is the concern of the sender is called the send
sliding window; the range that is the concern of the receiver is called the receive
sliding window.

UNIT 3 – DATA LINK LAYER Page 9


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

• The receive window makes sure that the correct data frames are received and that the
correct acknowledgments are sent. The size of the receive window is always 1. The
receiver is always looking for the arrival of a specific frame. Any frame arriving out of
order is discarded and needs to be resent. Figure shows the receive window.

• Note that it need only one variable Rn (receive window, next frame expected) to define
this abstraction. The sequence numbers to the left of the window belong to the frames
already received and acknowledged; the sequence numbers to the right of this window
define the frames that cannot be received.
• Any received frame with a sequence number in these two regions is discarded. Only a
frame with a sequence number matching the value of Rn is accepted and
acknowledged.
• The receive window also slides, but only one slot at a time. When a correct frame is
received (and a frame is received only one at a time), the window slides.
Timers
• Although there can be a timer for each frame that is sent, in our protocol we use only
one. The reason is that the timer for the first outstanding frame always expires first;
we send all outstanding frames when this timer expires.
Acknowledgment

UNIT 3 – DATA LINK LAYER Page 10


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
• The receiver sends a positive acknowledgment if a frame has arrived safe and sound
and in order. If a frame is damaged or is received out of order, the receiver is silent and
will discard all subsequent frames until it receives the one it is expecting.
• The silence of the receiver causes the timer of the unacknowledged frame at the
sender site to expire. This, in turn, causes the sender to go back and resend all frames,
beginning with the one with the expired timer. The receiver does not have to
acknowledge each frame received. It can send one cumulative acknowledgment for
several frames.
Resending a Frame
• When the timer expires, the sender resends all outstanding frames. For example,
suppose the sender has already sent frame 6, but the timer for frame 3 expires. This
means that frame 3 has not been acknowledged; the sender goes back and sends
frames 3, 4, 5, and 6 again. That is why the protocol is called Go-Back-N ARQ.
Design
• Figure shows the design for this protocol. As we can see, multiple frames can be in
transit in the forward direction, and multiple acknowledgments in the reverse
direction. The idea is similar to Stop-and-Wait ARQ; the difference is that the send.

3. Selective Repeat Automatic Repeat Request


• Go-Back-N ARQ simplifies the process at the receiver site. The receiver keeps track of
only one variable, and there is no need to buffer out-of-order frames; they are simply
discarded. However, this protocol is very inefficient for a noisy link.
• In a noisy link a frame has a higher probability of damage, which means the resending
of multiple frames. This resending uses up the bandwidth and 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 frame is resent. This
UNIT 3 – DATA LINK LAYER Page 11
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
mechanism is called Selective RepeatARQ. It is more efficient for noisy links, but the
processing at the receiver is more complex.
Windows
• The Selective Repeat Protocol also uses two windows: a send window and a receive
window. However, there are differences between the windows in this protocol and the
ones in Go-Back-N. First, the size of the send window is much smaller; it is 2m- I .
• The reason for this will be discussed later. Second, the receive window is the same size
as the send window. The send window maximum size can be 2m- I . For example, if m =
4, the sequence numbers go from 0 to 15, but the size of the window is just 8 (it is 15
in the Go-Back-N Protocol).
• The smaller window size means less efficiency in filling the pipe, but the fact that there
are fewer duplicate frames can compensate for this.
• The protocol uses the same variables as we discussed for Go-Back-N. We show the
Selective Repeat send window in Figure to emphasize the size.

Fig- Send window protocol


• The receive window in Selective Repeat is totally different from the one in GoBack- N.
First, the size of the receive window is the same as the size of the send window (2m- I).
• The Selective Repeat Protocol allows as many frames as the size of the receive window
to arrive out of order and be kept until there is a set of in-order frames to be delivered
to the network layer.
• Because the sizes of the send window and receive window are the same, all the frames
in the send frame can arrive out of order and be stored until they can be delivered. We
need, however, to mention that the receiver never delivers packets out of order to the
network layer.
• Figure shows the receive window in this protocol. Those slots inside the window that
are colored define frames that have arrived out of order and are waiting for their
eighbours to arrive before delivery to the network layer.

Fig- Receive window protocol

UNIT 3 – DATA LINK LAYER Page 12


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

POINT-TO-POINT PROTOCOL
• The Internet needs a point-to-point protocol for a variety of purposes, including
router to-router traffic and home user-to-ISP traffic.
• Although HDLC is a general protocol that can be used for both point-to-point and
multipoint configurations, one of the most common protocols for point-to-point access
is the Point-to-Point Protocol (PPP).
• Today, millions of Internet users who need to connect their home computers to the
server of an Internet service provider use PPP.
• The majority of these users have a traditional modem; they are connected to the
Internet through a telephone line, which provides the services of the physical layer.
But to control and manage the transfer of data, there is a need for a point-to-point
protocol at the data link layer.
• PPP is by far the most common. PPP handles error detection, supports multiple
protocols, allows IP addresses to be negotiated at connection time, permits
authentication, and has many other features.
• PPP provides several services:
1. PPP defines the format of the frame to be exchanged between devices.
2. PPP defines how two devices can negotiate the establishment of the link and
the exchange of data.
3. PPP defines how network layer data are encapsulated in the data link frame.
4. PPP defines how two devices can authenticate each other.
5. PPP provides multiple network layer services supporting a variety of
network layer protocols.
6. PPP provides connections over multiple links.
7. PPP provides network address configuration.

UNIT 3 – DATA LINK LAYER Page 13


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
• This is particularly useful when a home user needs a temporary network address to
connect to the Internet.
• On the other hand, to keep PPP simple, several services are missing:
1. PPP does not provide flow control. A sender can send several frames one
after another with no concern about overwhelming the receiver.
2. PPP has a very simple mechanism for error control. A CRC field is used to
detect errors. If the frame is corrupted, it is silently discarded; the upper-layer
protocol needs to take care of the problem. Lack of error control and sequence
numbering may cause a packet to be received out of order.
3. PPP does not provide a sophisticated addressing mechanism to handle
frames in a multipoint configuration.
• Frame Format of a PPP – PPP is a byte-oriented protocol. Framing is done according to
the discussion of byte-oriented protocols at the beginning of this chapter.
• Figure shows the format of a PPP frame. The description of each field follows: Fig –
Frame format of a PPP frame.

1. Flag. A PPP frame starts and ends with a 1-byte flag with the bit pattern
01111110.Although this pattern is the same as that used in HDLC, there is a big difference.
PPP is a byte-oriented protocol; HDLC is a bit-oriented protocol.

2. Address. The address field in this protocol is a constant value and set to 11111111
(broadcast address). During negotiation (discussed later), the two parties may agree to omit
this byte.

3. Control. This field is set to the constant value 11000000 (imitating unnumbered frames in
HDLC). PPP does not provide any flow control. Error control is also limited to error detection.
This means that this field is not needed at all, and again, the two parties can agree, during
negotiation, to omit this byte.

4. Protocol. The protocol field defines what is being carried in the data field: either user data
or other information. This field is by default 2 bytes long, but the two parties can agree to use
only 1 byte. The fourth PPP field is the Protocol field. Its job is to tell what kind of packet is in
the Payload field. Codes are defined for LCP, NCP, IP, IPX, AppleTalk, and other protocols.
Protocols starting with a 0 bit are network layer protocols such as IP, IPX, OSI CLNP, and XNS.
Those starting with a 1 bit are used to negotiate other protocols. These include LCP and a
different NCP for each network layer protocol supported.

UNIT 3 – DATA LINK LAYER Page 14


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
5. Payload field. This field carries either the user data or other information that we will
discuss shortly. The data field is a sequence of bytes with the default of a maximum of 1500
bytes; but this can be changed during negotiation. The data field is byte stuffed if the flag byte
pattern appears in this field. Because there is no field defining the size of the data field,
padding is needed if the size is less than the maximum default value or the maximum
negotiated value.

6. FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.

MULTIPLE ACCESS PROTOCOLS –


• To make a transmission successful interference must be avoided or at least controlled.
The channel then becomes the shared resource whose allocation is critical for proper
operation of the network.
• The access schemes to such channels known in the literature as Multiple Access
Protocols. These protocols are nothing but channel allocation schemes that possess
desirable performance characteristics.
• In terms of known networking models, such as the OSI reference model, these
protocols reside mostly within a special layer called the Medium Access Control (MAC)
layer. The MAC layer is between the Data Link Control (DLC) layer and the Physical
Layer.
• Data link layer is divided into two sub layers as shown in figure.

1. Data link control – responsible for flow and error control called the logical link control
2. Medium Access resolution – responsible for multiple access resolution called the medium
access control.

• The need for multiple access protocols arises not only in communications systems but
also in many other systems such as a computer system, a storage facility or a server of
any kind, where a resource is shared (and thus accessed) by a number of independent
users.
• Following figure shows the categories of multiple access protocols;

UNIT 3 – DATA LINK LAYER Page 15


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

RANDOM ACCESS PROTOCOLS –


• 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.
• Random access protocols are

1. ALOHA
2. Carrier Sense Multiple Access
3. Carrier Sense Multiple Access with Collision Detection
4. Carrier Sense Multiple Access with Collision Avoidance

1. ALOHA –

• The Aloha family of protocols is probably the richest family of multiple access
protocols.
• Its popularity is due first of all to seniority, as it is the first random access technique
introduced.
• Second, many of these protocols are so simple that their implementation is
straightforward.
• Many local area networks of today implement some sophisticated variants of this
family’s protocols.

UNIT 3 – DATA LINK LAYER Page 16


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
i. PURE ALOHA
• Earliest random-access method (1970s).
• Designed for radio LAN, but can be used for any shared medium.
• In pure ALOHA, each station sends a frame whenever it has a frame to send.
• More possibility of collisions.
• The idea is that each station sends a frame whenever it has a frame to send. However,
since there is an only one channel to share, there is the possibilities of collision
between frames from different stations.
• The pure Aloha protocol is very simple. It states that a newly generated packet is
transmitted immediately hoping for no interference by others.
• Should the transmission be unsuccessful, every colliding user, independently of the
others, schedules its retransmission to a random time in the future.
• This randomness is required to ensure that the same set of packets does not continue
to collide indefinitely.
• Figure shows an example of frame collisions in pure ALOHA.

• Pure ALOHA relies on acknowledgement from the receiver. If ACK not received after a
timeout period, the sender assumes that the frame is destroyed and resends the same.
• Collisions possible even during retransmissions. To solve this, pure ALOHA dictates
that after the time out passes, each station will wait for a random amount of time
called the back off time.

Figure - Vulnerable time for pure ALOHA protocol

UNIT 3 – DATA LINK LAYER Page 17


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
ii. SLOTTED ALOHA
• More efficient than pure ALOHA
• In slotted ALOHA, the time slots are divided into slots of Tfr, and the stations are
forced to send their frames only at the beginning of the time slot.
• Collisions are expected if two stations try to send at the beginning of the same time
slot.
• The vulnerable time is reduced to Tfr.
• The slotted Aloha variation of the Aloha protocol is simply that of pure Aloha with a
slotted channel. The slot size equals T--the duration of packet transmission.
• Users are restricted to start transmission of packets only at slot boundaries. Thus, the
vulnerable period is reduced to a single slot.
• In other words, a slot will be successful if and only if exactly one packet was scheduled
for transmission sometime during the previous slot.
• The throughput is therefore the fraction of slots (or probability) in which a single
packet is scheduled for transmission.

UNIT 3 – DATA LINK LAYER Page 18


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
2. CARRIER SENSE MULTIPLE ACCESS (CSMA) -
• CSMA method was developed to increase the performance by minimizing the chance of
collision. Here the station senses the medium before trying to use it.
• The chance of collision can be reduced if a station senses the medium before trying to
use it.
• CSMA requires each station to first listen the medium before sending. CSMA principle
is ‘sense before transmit” or “listen before talk”. CSMA can reduce the possibility of
collision, but it cannot eliminate it. The reason for this is shown in figure a space and
time model of a CSMA network. Stations are connected to a shared channel.
• The possibilities of collision still exist because of propagation delay when a station
sends a frame, it still takes time for the first bit to reach every station to sense it.
• In other words, a station may sense the medium and finds it idle, only because the first
bit sent by another station has not yet been received.
• 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 been reached station C. Station C also sends a frame. The two
signals collide and both frames are destroyed.

CSMA Protocols –
• Protocols in which stations listen for a carrier and act accordingly are called carrier
sense protocols. Following are the CSMA protocols (or techniques) –

Non-persistent CSMA –
• In this scheme, if a station wants to transmit a frame and it finds that the channel is
busy then it has to wait for fixed interval of time. After this time, it again checks the
status of the channel and if the channel is free then transmits.

UNIT 3 – DATA LINK LAYER Page 19


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------

1-persistent CSMA –
• In this scheme, the station which wants to transmit continuously monitors the channel
until it is idle and then transmits immediately.
• The disadvantages of this strategy are that if two stations transmit simultaneously a
collision takes place. Retransmission starts only after finding the channel free.

P-persistent CSMA –
• If the medium is idle, transmit with probability p, and delay for one time unit with
probability (1 – p) (time unit = length of propagation delay) If the medium is busy,
continue to listen until medium becomes idle, then go to Step 1 If transmission is
delayed by one time unit, continue with Step 1 The possibilities of such collisions and
retransmission are reduced in the persistent CSMA.
• In this scheme, all the waiting stations are not allowed to transmit simultaneously as
soon as the channel becomes idle. A station is assumed to be transmitting with
probability p. For example, if p=1/6 and if 6 stations are waiting then on an average,
only one station can transmit while others will wait.

UNIT 3 – DATA LINK LAYER Page 20


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
3. CARRIER SENSE MULTIPLE ACCESS WITH COLLISION DETECTION
(CSMA/CD)-
• The CSMA method does not specify the procedure following a collision. Carrier senses
multiple accesses with collision detection (CSMA/CD) augment 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.
• To better understand CSMA/CD, let us look at the first bits transmitted by the two
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.
• In Figure (a), stations A and C are involved in the collision.

• At time t 1, station A has executed its persistence procedure and 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 and starts sending the bits in its frame, which propagate both to
the left and to the right.
• The 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 (or after a short time,
but we assume immediately) aborts transmission.
• Station A detects collision at time t4 when it receives the first bit of C's frame; it also
immediately aborts transmission.
• Looking at the figure, we see that A transmits for the duration t4 - tl; C transmits for
the duration t3 - t2' Later we show that, for the protocol to work, the length of any
frame divided by the bit rate in this protocol must be more than either of these
durations.
• At time t4, the transmission of A: s frame, though incomplete, is aborted; at time t3, the
transmission of B's frame, though incomplete, is aborted.
• Now that we know the time durations for the two transmissions, we can show a more
complete graph in Figure (b).

UNIT 3 – DATA LINK LAYER Page 21


Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
4. CARRIER SENSE MULTIPLE ACCESS WITH COLLISION AVOIDANCE
(CSMA/CA)-
• The basic idea behind CSMA/CD is that a station needs to be able to receive while
transmitting to detect a collision. When there is no collision, the station receives one
signal: its own signal.
• When there is a collision, the station receives two signals: its own signal and the signal
transmitted by a second station. To distinguish between these two cases, the received
signals in these two cases must be significantly different.
• In other words, the signal from the second station needs to add a significant amount of
energy to the one created by the first station. In a wired network, the received signal
has almost the same energy as the sent signal because either the length of the cable is
short or there are repeaters that amplify the energy between the sender and the
receiver.
• This means that in a collision, the detected energy almost doubles. However, in a
wireless network, much of the sent energy is lost in transmission. The received signal
has very little energy.
• Therefore, a collision may add only 5 to 10 percent additional energy. This is not useful
for effective collision detection.
• We need to avoid collisions on wireless networks because they cannot be detected.
Carrier sense multiple access with collision avoidance (CSMA/CA) was invented for
this network. Collisions are avoided through the use of CSMA/CA's three strategies:
the inter frame space, the contention window, and acknowledgments, as shown in
Figure (a).

• Inter frame Space (IFS) First, collisions are avoided by deferring transmission even if
the channel is found idle. When an idle channel is found, the station does not send
immediately.
• It waits for a period of time called the inter frame space or IFS. Even though the
channel may appear idle when it is sensed, a distant station may have already started
transmitting.
• The distant station's signal has not yet reached this station. The IFS time allows the
front of the transmitted signal by the distant station to reach this station. If after the
IFS time the channel is still idle, the station can send, but it still needs to wait a time
equal to the contention time. The IFS variable can also be used to prioritize stations or
frame types. For example, a station that is assigned shorter IFS has a higher priority.

UNIT 3 – DATA LINK LAYER Page 22

You might also like