0% found this document useful (0 votes)
9 views39 pages

WEEK 4 Data Link Layer

The document covers the Data Link Layer, focusing on its primary function of providing reliable communication between network nodes. It discusses various Medium Access Control techniques, including controlled access methods like Reservation, Polling, and Token Passing, as well as random access methods such as ALOHA and CSMA protocols. Additionally, it addresses flow control and error detection mechanisms, highlighting methods like Stop-and-Wait ARQ, Go-Back-N ARQ, and error detection techniques such as Parity Check and Cyclic Redundancy Check (CRC).

Uploaded by

tayfuncebec602
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)
9 views39 pages

WEEK 4 Data Link Layer

The document covers the Data Link Layer, focusing on its primary function of providing reliable communication between network nodes. It discusses various Medium Access Control techniques, including controlled access methods like Reservation, Polling, and Token Passing, as well as random access methods such as ALOHA and CSMA protocols. Additionally, it addresses flow control and error detection mechanisms, highlighting methods like Stop-and-Wait ARQ, Go-Back-N ARQ, and error detection techniques such as Parity Check and Cyclic Redundancy Check (CRC).

Uploaded by

tayfuncebec602
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/ 39

WEEK 4

DATA LINK LAYER

Course Handled By
Femilda Josephin

1
AGENDA

• Medium Access Control Techniques


• Flow Control Mechanisms
• Error Detection and Mechanisms

2
DATALINK LAYER
• The primary function of the data link layer is to provide a reliable and error-free
communication link between two adjacent network nodes, such as between two
computers or between a computer and a switch.

3
DATA LINK LAYER - SUBLAYERS
• The upper sublayer is responsible for flow and error control is called Logical Link
Control(LLC) layer.
• The lower sublayer is responsible for multiple access resolution is called the
media access control (MAC) layer.
• When nodes or stations are connected and use a common link called a
multipoint or broadcast link, we need a multiple access protocol to coordinate
access to the link.

4
TAXONOMY OF MULTIPLE-ACCESS PROTOCOLS

5
CONTROLLED ACCESS

• In controlled access, the stations consult one another to find which station has
the right to send.
• A station cannot send unless it has been authorized by other stations.
• Three popular controlled-access methods.
1. Reservation
2. Polling
3. Token Passing

6
RESERVATION

• In the reservation method, a station needs to make a reservation before sending


data.
• Time is divided into intervals. In each interval, a reservation frame precedes the
data frames in that interval.
• If there are N stations in the system, there are exactly N reservation minislots in
the reservation frame. Each minislot belongs to a station.

7
POLLING
• It works with topologies in which one device is designated as a primary station
and the other devices are secondary stations.
• The primary device controls the link.
• The secondary devices follow its instructions.
• Primary device is to determine which device is allowed to use the channel at a
given time.(initiator of a session).
• If the primary wants to receive data, it asks the secondaries if they have
anything to send, this is called poll function.(poll)
• If the primary wants to send data, it tells the secondary to get ready to receive,
this is called select function.(SEL)

8
SELECT AND POLL FUNCTIONS IN POLLING ACCESS
METHOD

9
TOKEN PASSING
• The stations in a network are organized in a logical ring.
• For each station, there is a predecessor and a successor.
• A special packet called a token circulates through the ring.
• Token management, the token must be monitored to ensure it has not been lost or
destroyed.
Logical ring and physical topology in token-passing access method

10
RANDOM ACCESS
• 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.
• Two features
1. There is no schedule time for a station to transmit. Transmission is random
among the stations.
2. No rules specify which station should send next. Stations compete with one
another to access the medium
• If more than one station tries to send, there is an access conflict-Collision and
the frames will be either destroyed or modified.
11
• ALOHA, protocol which use a very simple procedure called multiple access.
• The method was improved with the procedure that forces the station to sense the medium
before transmitting. This was called Carrier Sense Multiple Access (CSMA)
• Carrier Sense Multiple Access with Collision Detection(CSMA/CD)
• Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA)
ALOHA
• It was designed for a radio(wireless) LAN, but it can be used on any shared medium.
Types of ALOHA
1. Pure ALOHA
2. Slotted ALOHA
Pure ALOHA(original ALOHA)
• Each station sends a frame whenever it has a frame to send.
• If one bit of a frame coexists on the channel with one bit from another frame, there is a
collision and both will be destroyed.
Frames in a pure ALOHA network

• Need to resend the frames that have been destroyed during transmission.
• Acknowledgement(time-out period)
Methods to prevent collision:
• Back-off time TB.(random amount of time)
• After a maximum number of retransmission attempts Kmax, a station must give up and try later.
13
Procedure for pure ALOHA protocol

14
SLOTTED ALOHA
• In slotted ALOHA, we divide the time into slots of Tfr and force the station
to send only at the beginning of the time slot.
• If a station misses the moment, it must wait until the beginning of the next
time slot.
• The station which started at the beginning of this slot has already finished
sending its frame.
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.
Slotted ALOHA vulnerable time = Tfr

15
Frames in a slotted ALOHA network

16
CARRIER SENSE MULTIPLE ACCESS(CSMA)

• CSMA requires that each station first listen to the medium before sending.( Sense before
transmit)
• It can reduce the possibility of collision, but it cannot eliminate it.
• The possibility of collision still exists because of propagation delay.
• A station may sense the medium and find 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 find it idle, so it sends a frame.
• At time t2(t2>t1), station c senses the medium and finds it idle because at this time, the first
bits from station B have not reached station C. station C also sends a frame.
• The two signals collide and both frames are destroyed.
17
PERSISTENCE METHODS
What should a station do if the channel is busy or is idle?
1-Persistent(Probability 1)
• After the station finds the line idle, it sends its frame immediately. This method has the highest chance of
collision.
NonPersistent
• A station that has a frame to send senses the line. If the line is idle, it sends immediately. If the line is not idle, it
waits a random amount of time and then senses the line again.
• It reduces the chance of collision and it reduces the efficiency of the network.
p-Persistent
• This method is used if the channel has time slots with a slot duration equal to or greater than the maximum
propagation time.
• It combines the advantages of the other two methods.
• It reduces the chance of collision and improves efficiency
18
PERSISTENCE METHODS

19
Persistent Methods

20
CSMA/ CD

• It is a carrier sense multiple access/ collision detection network


protocol to transmit data frames.
• The CSMA/CD protocol works with a medium access control layer.
• It first senses the shared channel before broadcasting the frames, and if the
channel is idle, it transmits a frame to check whether the transmission was
successful.
• If the frame is successfully received, the station sends another frame.
• If any collision is detected in the CSMA/CD, the station sends a jam/ stop
signal to the shared channel to terminate data transmission.
• After that, it waits for a random time before sending a frame to a channel.

21
CSMA/CD

22
CSMA/C A

• Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is a network


protocol for carrier transmission that operates in the Medium Access Control (MAC)
layer.
• CSMA/CA prevents collisions prior to their occurrence.
The algorithm of CSMA/CA is:
1. When a frame is ready, the transmitting station checks whether the channel is idle or
busy.
2. If the channel is busy, the station waits until the channel becomes idle.
3. If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of time and
then sends the frame.
4. After sending the frame, it sets a timer.
5. The station then waits for acknowledgement from the receiver. If it receives the
acknowledgement before expiry of timer, it marks a successful transmission.
6. Otherwise, it waits for a back-off time period and restarts the algorithm.
23
FLOW AND ERROR CONTROL

• Flow control refers to a set of procedures used to restrict the amount of data
that the sender can send before waiting for acknowledgment.
• Error control in the data link layer is based on automatic repeat request
(ARQ), which is the retransmission of data.
• ARQ types
1. Stop-and-Wait Automatic Repeat Request
2. Go-Back-N Automatic Repeat Request
3. Selective Repeat Automatic Repeat Request

24
STOP-AND-WAIT AUTOMATIC REPEAT REQUEST

• Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent


frame and retransmitting of the frame when the timer expires.
• In Stop-and-Wait ARQ, we use sequence numbers to number the frames. The
sequence numbers are based on modulo-2 arithmetic.
• In Stop-and-Wait ARQ, the acknowledgment number always announces in
modulo-2 arithmetic the sequence number of the next frame expected.

25
Flow diagram

26
GO-BACK-N AUTOMATIC REPEAT REQUEST

• In the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m is
the size of the sequence number field in bits.
• The send window is an abstract concept defining an imaginary box of size 2m − 1
with three variables:
Sf - Send window first outstanding frame
Sn - Send window next frame to send
and Ssize – Send window size
• The send window can slide one or more slots when a valid acknowledgment
arrives.

27
Send window for Go-Back-N ARQ

28
Flow diagram

29
COMPARISON OF GO-BACK-N AND SELECTIVE REPEAT

• Go-Back-N Protocol and “Selective Repeat Protocol” are the sliding window
protocols. The sliding window protocol is primarily an error control protocol
• The basic difference between go-back-n protocol and selective repeat protocol is
that the “go-back-n protocol” retransmits all the frames that lie after the frame
which is damaged or lost.
• The “selective repeat protocol” retransmits only that frame which is damaged or
lost.

30
GO-BACK-N

31
SELECTIVE REPEAT

32
ERROR DETECTION

• Error
• A condition when the receiver’s information does not match with the sender’s information.
• During transmission, digital signals suffer from noise that can introduce errors in the binary bits travelling
from sender to receiver. That means a 0 bit may change to 1 or a 1 bit may change to 0.
• Error Detecting Codes are implemented either at Data link layer or Transport Layer of OSI Model
• Whenever a message is transmitted, it may get scrambled by noise or data may get corrupted.
• To avoid this, we use error-detecting codes which are additional data added to a given digital message to
help us detect if any error has occurred during transmission of the message.
• Some popular techniques for error detection are:
1. Simple Parity check
2. Two-dimensional Parity check
3. Checksum
4. Cyclic redundancy check

33
SIMPLE PARITY CHECK

• Blocks of data from the source are subjected to a check bit or parity bit generator
form, where a parity of :
• 1 is added to the block if it contains odd number of 1’s, and
• 0 is added if it contains even number of 1’s
• This scheme makes the total number of 1’s even, that is why it is called even
parity checking.

34
TWO-DIMENSIONAL PARITY CHECK

• Parity check bits are calculated for each row, which is equivalent to a simple parity check
bit.
• Parity check bits are also calculated for all columns, then both are sent along with the
data.
• At the receiving end these are compared with the parity bits calculated on the received
data.

35
CHECKSUM

• In checksum error detection scheme, the data is divided into k segments each of
m bits.
• In the sender’s end the segments are added using 1’s complement arithmetic to
get the sum. The sum is complemented to get the checksum.
• The checksum segment is sent along with the data segments.
• At the receiver’s end, all received segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented.
• If the result is zero, the received data is accepted; otherwise discarded.

36
CHECKSUM

37
CYCLIC REDUNDANCY CHECK (CRC)

• Unlike checksum scheme, which is based on addition, CRC is based on binary division.
• In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are appended to
the end of data unit so that the resulting data unit becomes exactly divisible by a second,
predetermined binary number.
• At the destination, the incoming data unit is divided by the same number.
• If at this step there is no remainder, the data unit is assumed to be correct and is therefore
accepted.
• A remainder indicates that the data unit has been damaged in transit and therefore must
be rejected.

38
CYCLIC REDUNDANCY CHECK (CRC)

39

You might also like