0% found this document useful (0 votes)
22 views18 pages

Unit 2

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

Unit 2

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

UNIT -2 (Data Link Layer)

Data Link Layer:- 1.Data link layer is responsible to accept packet from network layer and encapsulate into
frame by adding header and trailer. It is responsible to move frame from one node to another node.
2. The IEEE has subdivided the data – link layer into two sublayers: logical link control (LLC) (Top) and media access
control(MAC)(Bottom).

Functionality of Data Link Layer:- 1. Framming


2. Error control and Detection
3. Flow control
4. Access control
5. Physical addressing
1. Framming:- Data Link Layer take the packet from network layer and encapsulate into frame. DLL send each
frame bit-by bit to the hardware(physical layer). At the receiver end DLL pick up bit from physical layer and
assambles into frame.

 Frame:- It contain source and destination of the frame.


 Trailer:- It contain error detection and correction bit.
 Payload:- Actual message to be deliver.

2. Error Correction and Detection:- When data is transmitted from one device to another device .The
system does not guarantee whether the data is received by device identical an error is a situation when the
message received at the receiver end is not identical to message receive.

Type of Error:- 1. Single bit error


2. Burst error
1. Single bit error:- A single-bit error refers to a type of data transmission error that occurs when one bit (i.e., a
single binary digit) of a transmitted data unit is altered during transmission, resulting in an incorrect or corrupted data
unit.
2. Burst error:- When several consecutive bits are flipped mistakenly in digital transmission, it creates a burst error.
This error causes a sequence of consecutive incorrect values.

Error detection :-
1, Simple Parity Check
2. Two-dimensional Parity Check
3. Checksum
4. Cyclic Redundancy Check (CRC)

Simple Parity Check:- Simple-bit parity is a simple error detection method that involves adding an extra bit to a data
transmission. It works as:

 1 is added to the block if it contains an odd number of 1’s, and


 0 is added if it contains an even number of 1’s
This scheme makes the total number of 1’s even, that is why it is called even parity checking.

Disadvantages
 Single Parity check is not able to detect even no. of bit error.
 For example, the Data to be transmitted is 101010. Codeword transmitted to the receiver is 1010101 (we have used even
parity).
Let’s assume that during transmission, two of the bits of code word flipped to 1111101.
On receiving the code word, the receiver finds the no. of ones to be even and hence no error, which is a wrong assumption.

Two-dimensional Parity Check


Two-dimensional 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.
Checksum
Checksum error detection is a method used to identify errors in transmitted data. The process involves dividing the data into
equally sized segments and using a 1’s complement to calculate the sum of these segments. The calculated sum is then sent
along with the data to the receiver. At the receiver’s end, the same process is repeated and if all zeroes are obtained in the sum,
it means that the data is correct.
Checksum – Operation at Sender’s Side
 Firstly, the data is divided into k segments each of m bits.
 On 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.
Checksum – Operation at Receiver’s Side
 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.

Disadvantages
 If one or more bits of a segment are damaged and the corresponding bit or bits of opposite value in a second segment are also
damaged.

Cyclic Redundancy Check (CRC)

 Unlike the 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 the 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.

Flow Control:- a. Flow control is a set of procedure that tells the sender how much data it can transmit before
it wait for acknowledgement from receiver.

b. Speed matching mechanism.

c. Receiver must inform sender before the limit are reached and request that transmitter to send fewer frame or
stop temporarily.
d. Flow control technique that allows two station working at different speed to communicate with each other.

Noiseless Channels:- Noiseless is an ideal or perfect channel where no frames are lost, duplicated, or corrupted.

There are two noiseless channels which are as follows –

 Simplex channel
 Stop & wait channel

Simplest Protocol
 Step 1 − Simplest protocol that does not have flow or error control.
 Step 2 − It is a unidirectional protocol where data frames are traveling in one direction that is from the sender to
receiver.
 Step 3 – No acknowledgement.
Stop-and-Wait Protocol
Step 1 − If the data frames that arrive at the receiver side are faster than they can be processed, the frames must be stored until their use.
Step 2 − Generally, the receiver does not have enough storage space, especially if it is receiving data from many sources. This may result in
either discarding of frames or denial of service.
Step 3 − In this protocol the sender sends one frame, stops until it receives confirmation from the receiver, and then sends the next frame.
Step 4 − We still have unidirectional communication for data frames, but auxiliary ACK frames travel from the other direction. We add flow
control to the previous protocol.

Noisy Channels:- Noiseless channels are generally non-existent channels. We can ignore the error or we need to add error control to
our protocols.

There are three types of requests for the noisy channels, which are as follows –
 Stop & wait Automatic Repeat Request.
 Go-Back-N Automatic Repeat Request.
 Selective Repeat Automatic Repeat Request.
Stop and Wait Automatic Repeat Request:-
Step 1:- After transmitting one frame , the sender wait for an acknowledgment before sending next frame.

Step 2 :- If Ack is not arrive a certain period of time, the sender time out and retransmit original frame.

Step 3:- Stop and wait ARQ = stop and wait + timeout timer + sequence number of frame.

Step 4:- If after error and flow control.

Go-Back-N ARQ:-
Step 1 − In this protocol we can send several frames before receiving acknowledgements.

Step 2 − we keep a copy of these frames until the acknowledgment arrives.

Step 3 − Frames from a sending station are numbered sequentially. However, we need to include the sequence number of each
frame in the header; we need to set a limit.

Step 4 − If the header of the frame allows m bits for the sequence number, the sequence numbers range from 0 to 2 m-1. We can
also repeat the sequence numbers.

Example:-
Let's assume that the receiver has sent the acknowledgment for the 0 frame, and the receiver has successfully received it.

The sender will then send the next frame, i.e., 4, and the window slides containing four frames (1,2,3,4).

The receiver will then send the acknowledgment for the frame no 1. After receiving the acknowledgment, the sender will send the
next frame, i.e., frame no 5, and the window will slide having four frames (2,3,4,5).
Now, let's assume that the receiver is not acknowledging the frame no 2, either the frame is lost, or the acknowledgment is lost.
Instead of sending the frame no 6, the sender Go-Back to 2, which is the first frame of the current window, retransmits all the
frames in the current window, i.e., 2,3,4,5.

Example 1: In GB4, if every 6th packet being transmitted is lost and if we have to spend 10 packets then how many transmissions are required?

Solution: Here, GB4 means that N is equal to 4. The size of the sender's window is 4.

Step 1: As the window size is 4, so four packets are transferred at a time, i.e., packet no 1, packet no 2, packet no 3, and packet no 4.
Step 2:

Step 3:

Step 4:

Step 5:
Step 6:

Step 7:

Step 8:
Step 9:

Step 10:

Step 11: As the 8th packet has 6 counter value which means that 8th packet has been lost, and the sender receives NAK (8)

Step 12: Since the sender has received the negative acknowledgment for the 8 th packet, it resends all the packets of the current window, i.e., 8, 9, 10.
Step 13: The counter values of 8, 9, 10 are 3, 4, 5, respectively, so their acknowledgments have been received successfully.

We conclude from the above figure that total 17 transmissions are required

Channel Allocation Problem in Computer Network



Channel allocation is a process in which a single channel is divided and allotted to multiple users in order to carry user specific tasks.
There are user’s quantity may vary every time the process takes place. If there are N number of users and channel is divided into N
equal-sized sub channels, Each user is assigned one portion. If the number of users are small and don’t vary at times, then Frequency
Division Multiplexing can be used as it is a simple and efficient channel bandwidth allocating technique.
Channel allocation problem can be solved by two schemes: Static Channel Allocation in LANs and MANs, and Dynamic Channel
Allocation.

1. Static Channel Allocation in LANs and MANs:

It is the classical or traditional approach of allocating a single channel among multiple competing users using Frequency Division Multiplexing
(FDM). if there are N users, the frequency channel is divided into N equal sized portions (bandwidth), each user being assigned one portion.
since each user has a private frequency band, there is no interference between users.
However, it is not suitable in case of a large number of users with variable bandwidth requirements.
It is not efficient to divide into fixed number of chunks.

T = 1/(U*C-L)

T(FDM) = N*T(1/U(C/N)-L/N)
Where,

T = mean time delay,


C = capacity of channel,
L = arrival rate of frames,
1/U = bits/frame,
N = number of sub channels,
T(FDM) = Frequency Division Multiplexing Time

2. Dynamic Channel Allocation:

In dynamic channel allocation scheme, frequency bands are not permanently assigned to the users. Instead channels are allotted to users dynamically as
needed, from a central pool. The allocation is done considering a number of parameters so that transmission interference is minimized.
This allocation scheme optimises bandwidth usage and results is faster transmissions.
Dynamic channel allocation is further divided into:

1. Centralised Allocation
2. Distributed Allocation

Possible assumptions include:

Station Model:
Assumes that each of N stations independently produce frames. The probability of producing a packet in the interval IDt where I is the constant arrival rate
of new frames.

Single Channel Assumption:


In this allocation all stations are equivalent and can send and receive on that channel.

Collision Assumption:
If two frames overlap in time-wise, then that’s collision. Any collision is an error, and both frames must re transmitted. Collisions are only possible error.

Time can be divided into Slotted or Continuous.

Stations can sense a channel is busy before they try it.

multiple access protocol:- When a sender and receiver have a dedicated link to transmit data packets, the data link control
is enough to handle the channel. Suppose there is no dedicated path to communicate or transfer the data between two devices. In that case,
multiple stations access the channel and simultaneously transmits the data over the channel. It may create collision and cross talk. Hence, the
multiple access protocol is required to reduce the collision and avoid crosstalk between the channels.

A. Random Access Protocol:- Random Access Protocols help to manage this chaos by dividing the channel into time slots or packets
of data. It is a Multiple access protocol that is divided into four categories which are ALOHA, CSMA, CSMA/CD, and CSMA/CA.

ALOHA Random Access Protocol

It is designed for wireless LAN (Local Area Network) but can also be used in a shared medium to transmit data. Using this method, any station
can transmit data across a network simultaneously when a data frameset is available for transmission.

Aloha Rules

1. Any station can transmit data to a channel at any time.


2. It does not require any carrier sensing.
3. Collision and data frames may be lost during the transmission of data through multiple stations.
4. Acknowledgment of the frames exists in Aloha. Hence, there is no collision detection.
5. It requires retransmission of data after some random amount of time.
Pure Aloha

Whenever data is available for sending over a channel at stations, we use Pure Aloha. In pure Aloha, when each station transmits
data to a channel without checking whether the channel is idle or not, the chances of collision may occur, and the data frame can
be lost. When any station transmits the data frame to a channel, the pure Aloha waits for the receiver's acknowledgment. If it does
not acknowledge the receiver end within the specified time, the station waits for a random amount of time, called the back off time
(Tb). And the station may assume the frame has been lost or destroyed. Therefore, it retransmits the frame until all the data are
successfully transmitted to the receiver.

1. The total vulnerable time of pure Aloha is 2 * Tfr.


2. Maximum throughput occurs when G = 1/ 2 that is 18.4%.
3. Successful transmission of data frame is S = G * e ^ - 2 G.

As we can see in the figure above, there are four stations for accessing a shared channel and transmitting data frames. Some frames collide because
most stations send their frames at the same time. Only two frames, frame 1.1 and frame 2.2, are successfully transmitted to the receiver end. At the
same time, other frames are lost or destroyed. Whenever two frames fall on a shared channel simultaneously, collisions can occur, and both will
suffer damage. If the new frame's first bit enters the channel before finishing the last bit of the second frame. Both frames are completely finished,
and both stations must retransmit the data frame.

Slotted Aloha

The slotted Aloha is designed to overcome the pure Aloha's efficiency because pure Aloha has a very high possibility of frame hitting. In slotted
Aloha, the shared channel is divided into a fixed time interval called slots. So that, if a station wants to send a frame to a shared channel, the frame
can only be sent at the beginning of the slot, and only one frame is allowed to be sent to each slot. And if the stations are unable to send data to
the beginning of the slot, the station will have to wait until the beginning of the slot for the next time. However, the possibility of a collision remains
when trying to send a frame at the beginning of two or more station time slot.

1. Maximum throughput occurs in the slotted Aloha when G = 1 that is 37%.


2. The probability of successfully transmitting the data frame in the slotted Aloha is S = G * e ^ - 2 G.
3. The total vulnerable time required in slotted Aloha is Tfr.
CSMA (Carrier Sense Multiple Access)

It is a carrier sense multiple access based on media access protocol to sense the traffic on a channel (idle or busy) before
transmitting the data. It means that if the channel is idle, the station can send data to the channel. Otherwise, it must wait until the
channel becomes idle. Hence, it reduces the chances of a collision on a transmission medium.

CSMA Access Modes

1-Persistent: In the 1-Persistent mode of CSMA that defines each node, first sense the shared channel and if the channel is idle, it immediately
sends the data. Else it must wait and keep track of the status of the channel to be idle and broadcast the frame unconditionally as soon as the
channel is idle.

Non-Persistent: It is the access mode of CSMA that defines before transmitting the data, each node must sense the channel, and if the channel is
inactive, it immediately sends the data. Otherwise, the station must wait for a random time (not continuously), and when the channel is found to be
idle, it transmits the frames.

P-Persistent: It is the combination of 1-Persistent and Non-persistent modes. The P-Persistent mode defines that each node senses the channel,
and if the channel is inactive, it sends a frame with a P probability. If the data is not transmitted, it waits for a (q = 1-p probability) random time
and resumes the frame with the next time slot.

O- Persistent: It is an O-persistent method that defines the superiority of the station before the transmission of the frame on the shared channel. If
it is found that the channel is inactive, each station waits for its turn to retransmit the data.
ADVERTISEMENT

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. Therefore, 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.

CSMA/ CA

It is a carrier sense multiple access/collision avoidance network protocol for carrier transmission of data frames. It is a protocol that works with a
medium access control layer. When a data frame is sent to a channel, it receives an acknowledgment to check whether the channel is clear. If the
station receives only a single (own) acknowledgments, that means the data frame has been successfully transmitted to the receiver. But if it gets two
signals (its own and one more in which the collision of frames), a collision of the frame occurs in the shared channel. Detects the collision of the
frame when a sender receives an acknowledgment signal.

Following are the methods used in the CSMA/ CA to avoid the collision:

Inter frame space: In this method, the station waits for the channel to become idle, and if it gets the channel is idle, it does not immediately send
the data. Instead of this, it waits for some time, and this time period is called the Interframe space or IFS. However, the IFS time is often used to
define the priority of the station.

Contention window: In the Contention window, the total time is divided into different slots. When the station/ sender is ready to transmit the data
frame, it chooses a random slot number of slots as wait time. If the channel is still busy, it does not restart the entire process, except that it restarts
the timer only to send data packets when the channel is inactive.

Acknowledgment: In the acknowledgment method, the sender station sends the data frame to the shared channel if the acknowledgment is not
received ahead of time.

B. Controlled Access Protocol

It is a method of reducing data frame collision on a shared channel. In the controlled access method, each station interacts and decides to send a
data frame by a particular station approved by all other stations. It means that a single station cannot send the data frames unless all other stations
are not approved. It has three types of controlled access: Reservation, Polling, and Token Passing.
C. Channelization Protocols

It is a channelization protocol that allows the total usable bandwidth in a shared channel to be shared across multiple stations
based on their time, distance and codes. It can access all the stations at the same time to send the data frames to the channel.

Following are the various methods to access the channel based on their time, distance and codes:

1. FDMA (Frequency Division Multiple Access)


2. TDMA (Time Division Multiple Access)
3. CDMA (Code Division Multiple Access)

FDMA

It is a frequency division multiple access (FDMA) method used to divide the available bandwidth into equal bands so that multiple users can send
data through a different frequency to the subchannel. Each station is reserved with a particular band to prevent the crosstalk between the channels
and interferences of stations.

TDMA

Time Division Multiple Access (TDMA) is a channel access method. It allows the same frequency bandwidth to be shared across multiple stations.
And to avoid collisions in the shared channel, it divides the channel into different frequency slots that allocate stations to transmit the data frames.
The same frequency bandwidth into the shared channel by dividing the signal into various time slots to transmit it. However, TDMA has an
overhead of synchronization that specifies each station's time slot by adding synchronization bits to each slot.

CDMA

The code division multiple access (CDMA) is a channel access method. In CDMA, all stations can simultaneously send the data over the same
channel. It means that it allows each station to transmit the data frames with full frequency on the shared channel at all times. It does not require the
division of bandwidth on a shared channel based on time slots. If multiple stations send data to a channel simultaneously, their data frames are
separated by a unique code sequence. Each station has a different unique code for transmitting the data over a shared channel. For example, there
are multiple users in a room that are continuously speaking. Data is received by the users if only two-person interact with each other using the same
language. Similarly, in the network, if different stations communicate with each other simultaneously with different code languag

You might also like