Unit - 3
Data link layer
When data is sent from one computer to another, the system cannot guarantee that the data received by the device is similar to the data sent by the other device. When the message received at the recipient end differs from the message sent, it is called an error.
Types of Error
● Single - bit error: Just one bit in the obtained frame has been corrupted, i.e. it has been modified from 0 to 1 or 1 to 0.
Fig 1: Single-bit error
● Burst error: Burst Error occurs when two or more bits are shifted from 0 to 1 or 1 to 0. More than one consecutive bit in the received frame was corrupted.
Fig 2: Burst error
Error Detecting Technique
There are three major methods for identifying frame errors:
- Parity check
- Checksum
- Cyclic Redundancy check
Parity Check
The parity check is performed by adding an extra bit to the data called the parity bit, which results in a number of 1s that is either even in even parity or odd in odd parity.
The sender counts the number of 1s in a frame and adds the parity bit in the following way when making it.
● Even parity: The parity bit value is 0 if the number of 1s is even. The parity bit value is 1 if the number of 1s is odd.
● Odd parity: The parity bit value is 0 if the number of 1s is odd. The parity bit value is 1 if the number of 1s is even.
The receiver counts the number of 1s in a frame as it receives it. If the count of 1s is even in an even parity search, the frame is accepted; otherwise, it is rejected. For odd parity search, a similar rule is used. The parity check is only good for detecting single bit errors.
Fig 3: Parity check
Checksum
The following procedure is used in this error detection scheme:
● Data is divided into frames or segments of a predetermined dimension.
● To get the sum, the sender adds the segments using 1's complement arithmetic. It then adds the sums together to get the checksum, which it sends along with the data frames.
● To get the number, the receiver adds the incoming segments and the checksum using 1's complement arithmetic, then complements it.
● The obtained frames are approved if the outcome is zero; otherwise, they are discarded.
Cyclic Redundancy Check (CRC)
CRC is a binary division of the data bits being sent by a fixed divisor agreed upon by the communicating machine. Polynomials are used to build the divisor.
Here, the sender divides the data segment by the divisor in binary. The remaining CRC bits are then appended to the end of the data segment. As a consequence, the resulting data unit is divisible by the divisor exactly.
The divisor is used by the receiver to separate the incoming data unit. The data unit is considered to be right and approved if there is no remainder. Otherwise, it's assumed that the data is tainted and will be denied.
Fig 4: CRC
Key takeaway
When data is sent from one computer to another, the system cannot guarantee that the data received by the device is similar to the data sent by the other device. When the message received at the recipient end differs from the message sent, it is called an error.
Data transmission at the physical layer entails the synchronized transmission of bits from the source to the destination. These bits are packed into frames by the data link layer.
The Data-link Layer encapsulates the packets from the Network Layer into frames. If the frame size gets too big, the packet can be split up into smaller frames. Flow control and error control are more effective with smaller frames.
Then it sends each frame to the hardware bit by bit. The data link layer at the receiver's end collects signals from hardware and assembles them into frames.
Fig 5: Framing
Parts of the Framing
A frame has the following pieces −
● Frame header: It includes the frame's source and destination addresses.
● Payload field: It holds the message that will be sent.
● Trailer: It includes the bits for error detection and correction.
● Field: It denotes the start and end of the frame.
Fig 6: Parts of frames
Types of Framing
There are two styles of framing: fixed sized framing and variable sized framing.
Fixed - size framing: The frame size is set in this case, so the frame length serves as a delimiter. As a result, no additional boundary bits are required to define the start and end of the frame.
Variable - size framing: The size of each frame to be transmitted can differ in this case. As a result, additional mechanisms are held to indicate the end of one frame and the start of the next.
It's a protocol that's used in local area networks.
In variable-sized framing, there are two ways to describe frame delimiters.
Length Field: The size of the frame is determined by a length field in this case. Ethernet makes use of it (IEEE 802.3).
End Delimiter: To decide the size of the frame, a pattern is used as a delimiter. Token Rings make use of it. If the pattern appears in the message, there are two options for dealing with the case.
● Byte - stuffing: To distinguish the message from the delimiter, a byte is crammed into it. Character-oriented framing is another term for this.
● Bit - stuffing: To distinguish the message from the delimiter, a pattern of bits of arbitrary duration is stuffed into it. This is often referred to as bit-oriented framing.
Key takeaway:
- The Data-link Layer encapsulates the packets from the Network Layer into frames.
- If the frame size gets too big, the packet can be split up into smaller frames.
No frames are lost, distorted, or duplicated in this idealized channel. In this category, the protocol does not offer error control. For the noiseless channel, there are two protocols to choose from.
Simplex
We'll assume that the receiver can keep every frame it receives with minimal processing time. The data link layer of the receiver removes the header from the frame right away and allocates the data packet to its network layer, which can accept it right away. That is, the receiver will never be overloaded with frames to come.
Design
The sender site's data link layer receives data from its network layer, creates a frame out of it, and transfers it. The data link layer (receiver site) receives a frame from the physical layer, extracts the data from it, and sends it to the network layer. The sender and receiver's data link levels provide communication/transmission services to their network layers. For the physical conveyance of bits, the data link layers use the services supplied by respective physical layers.
Fig 7: Design of Simplest Protocol with no error control or flow
Sender-site and Receivers algorithms:
Sender-site algorithm –
While(true) //Repeat forever
{
WaitForEvent(); //sleep untill an event occur
If (Event(RequestToSend)) //there is a packet to send
{
GetData();
MakeFrame();
SendFrame(); //send the frame
}
}
Receivers algorithm –
While(true) //Repeat forever
{
WaitForEvent(); //sleep until an event occur
If (Event(ArrivalNotification)) //data frame arrived
{
ReceiveFrame();
ExtractData();
DeliverData(); //Deliver data to network layer
}
}
Flow Diagram
This flow diagram depicts a communication example utilising the most basic protocol. It's simple to understand. The transmitter simply delivers a series of frames with no regard for the receiver. Consider the following scenario: the sender will send three frames, and the receivers will get three frames. Keep in mind that data frames are represented by tilted boxes, with the height of the box indicating the difference in transmission time between the first and last bit in the frame.
Fig 8: Flow diagram for simplex
Stop and Wait Protocol
Before understanding the stop and Wait protocol, we first know about the error control mechanism. The error control mechanism is used so that the received data should be exactly the same whatever the sender has sent the data. The error control mechanism is divided into two categories, i.e., Stop and Wait ARQ and sliding window. The sliding window is further divided into two categories, i.e., Go Back N, and Selective Repeat. Based on the usage, the people select the error control mechanism whether it is stop and wait or sliding window.
What is the Stop and Wait protocol?
Here stop and wait means, whatever the data that sender wants to send, he sends the data to the receiver. After sending the data, he stops and waits until he receives the acknowledgment from the receiver. The stop and wait protocol is a flow control protocol where flow control is one of the services of the data link layer.
It is a data-link layer protocol which is used for transmitting the data over the noiseless channels. It provides unidirectional data transmission which means that either sending or receiving of data will take place at a time. It provides flow-control mechanism but does not provide any error control mechanism.
The idea behind the usage of this frame is that when the sender sends the frame then he waits for the acknowledgment before sending the next frame.
Primitives of Stop and Wait Protocol
The primitives of stop and wait protocol are:
Sender side
Rule 1: Sender sends one data packet at a time.
Rule 2: Sender sends the next packet only when it receives the acknowledgment of the previous packet.
Therefore, the idea of stop and wait protocol in the sender's side is very simple, i.e., send one packet at a time, and do not send another packet before receiving the acknowledgment.
Receiver side
Rule 1: Receive and then consume the data packet.
Rule 2: When the data packet is consumed, receiver sends the acknowledgment to the sender.
Therefore, the idea of stop and wait protocol in the receiver's side is also very simple, i.e., consume the packet, and once the packet is consumed, the acknowledgment is sent. This is known as a flow control mechanism.
Advantages
The Stop-and-Wait approach is straightforward, as each frame is tested and accepted before sending the next.
Disadvantages
Since each frame must travel all the way to the recipient, and an acknowledgment must travel all the way until the next frame is sent, the stop-and-wait strategy is inefficient. Each frame sent and received consumes the entire connection traversal time.
Working of Stop and Wait protocol
Fig 9: Stop and wait protocol
The stop and wait protocol is depicted in the diagram above. If a sender and receiver are present, the sender sends the packet, which is referred to as a data packet. The sender will not send the second packet until the first packet has been acknowledged. The acknowledgement for the data packet received is sent by the receiver. The sender sends the next packet after receiving the acknowledgment. This operation is repeated until all of the packets have been sent. This protocol's greatest benefit is its simplicity, but it also has certain drawbacks. If 1000 data packets are to be transferred, for example, all 1000 packets cannot be sent at the same time since the Stop and Wait protocol only sends one packet at a time.
Stop-and-wait In the event of broken or lost frames, ARQ is a technique for retransmitting the data.
This approach works on the idea that the sender will not transmit the next frame until the previous frame has been acknowledged.
Step 1: If a frame is destroyed during transmission in a noisy channel, the receiver will detect it using the checksum.
Step 2: If a damaged frame is received, it will be discarded, and the transmitter will retransmit the frame whenever a proper acknowledgement is received.
Step 3: If the acknowledgement frame is missing, the data link layer on 'A' will eventually time out. It assumes that its data frame was lost or corrupted because it did not receive an ACK and sends the frame containing packet 1 again. Because this duplicate frame also arrives on 'B' at the data link layer, a portion of the file will be duplicated, and the protocol will be considered unsuccessful.
Step 4: In the message header, assign a sequence number to remedy this problem.
Step 5: Because only the message is transmitted at any one moment, the receiver examines the sequence number to see if the message is a duplicate.
Step 6: To preserve the relationship between the broadcast message and its ACK/ NAK, the sending and receiving stations simply need a 1-bit alternating sequence of '0' or'1'.
Step 7: A modulo-2 numbering scheme is utilized, with frames labeled '0' or '1' and positive acknowledgements of the type ACK 0 and ACK 1.
The normal operation of the Stop & Wait ARQ is as follows:
The Stop & Wait ARQ with Lost Frame looks like this:
Characteristics
The retransmission must have four characteristics:
● Until the acknowledgement is received, the sending device stores a duplicate of the last broadcast frame. If the frame is not received correctly, the sender might retransmit the data by keeping the copy.
● The data and ACK frames are both numbered 0 and 1 so that they can be distinguished from one another. If data 1 frame acknowledges data 0 frame, it signifies that data 0 frame arrived correctly and that data 1 frame is on its way.
● If the final transmitted frame contains an error, the receiver sends the NAK frame, which has no number. The sender retransmits the data after receiving the NAK frame.
● It operates in conjunction with the timer. If the acknowledgement does not arrive within the permitted time, the sender concludes that the frame was lost during transmission and will retransmit it.
Go-Back-N ARQ
Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat Request. It is a data link layer protocol that uses a sliding window method. In this, if any frame is corrupted or lost, all subsequent frames have to be sent again.
In Go-Back-N ARQ, N is the sender's window size. Suppose we say that Go-Back-3, which means that the three frames can be sent at a time before expecting the acknowledgment from the receiver.
It uses the principle of protocol pipelining in which the multiple frames can be sent before receiving the acknowledgment of the first frame. If we have five frames and the concept is Go-Back-3, which means that the three frames can be sent, i.e., frame no 1, frame no 2, frame no 3 can be sent before expecting the acknowledgment of frame no 1.
In Go-Back-N ARQ, the frames are numbered sequentially as Go-Back-N ARQ sends the multiple frames at a time that requires the numbering approach to distinguish the frame from another frame, and these numbers are known as the sequential numbers.
The number of frames that can be sent at a time totally depends on the size of the sender's window. So, we can say that 'N' is the number of frames that can be sent at a time before receiving the acknowledgment from the receiver.
If the acknowledgment of a frame is not received within an agreed-upon time period, then all the frames available in the current window will be retransmitted. Suppose we have sent the frame no 5, but we didn't receive the acknowledgment of frame no 5, and the current window is holding three frames, then these three frames will be retransmitted.
The sequence number of the outbound frames depends upon the size of the sender's window. Suppose the sender's window size is 2, and we have ten frames to send, then the sequence numbers will not be 1,2,3,4,5,6,7,8,9,10. Let's understand through an example.
● N is the sender's window size.
● If the size of the sender's window is 4 then the sequence number will be 0,1,2,3,0,1,2,3,0,1,2, and so on.
The number of bits in the sequence number is 2 to generate the binary sequence 00,01,10,11.
Working of Go-Back-N ARQ
Suppose there are a sender and a receiver, and let's assume that there are 11 frames to be sent. These frames are represented as 0,1,2,3,4,5,6,7,8,9,10, and these are the sequence numbers of the frames. Mainly, the sequence number is decided by the sender's window size. But, for the better understanding, we took the running sequence numbers, i.e., 0,1,2,3,4,5,6,7,8,9,10. Let's consider the window size as 4, which means that the four frames can be sent at a time before expecting the acknowledgment of the first frame.
Step 1: Firstly, the sender will send the first four frames to the receiver, i.e., 0,1,2,3, and now the sender is expected to receive the acknowledgment of the 0th frame.
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.
Selective Repeat ARQ
Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request. It is a data link layer protocol that uses a sliding window method. The Go-back-N ARQ protocol works well if it has fewer errors. But if there is a lot of error in the frame, lots of bandwidth loss in sending the frames again. So, we use the Selective Repeat ARQ protocol. In this protocol, the size of the sender window is always equal to the size of the receiver window. The size of the sliding window is always greater than 1.
If the receiver receives a corrupt frame, it does not directly discard it. It sends a negative acknowledgment to the sender. The sender sends that frame again as soon as on the receiving negative acknowledgment. There is no waiting for any time-out to send that frame. The design of the Selective Repeat ARQ protocol is shown below.
Selective repeat protocol, also called Selective Repeat ARQ (Automatic Repeat reQuest), is a data link layer protocol that uses sliding window method for reliable delivery of data frames. Here, only the erroneous or lost frames are retransmitted, while the good frames are received and buffered.
It uses two windows of equal size: a sending window that stores the frames to be sent and a receiving window that stores the frames receive by the receiver. The size is half the maximum sequence number of the frame. For example, if the sequence number is from 0 – 15, the window size will be 8.
Working Principle
Selective Repeat protocol provides for sending multiple frames depending upon the availability of frames in the sending window, even if it does not receive acknowledgement for any frame in the interim. The maximum number of frames that can be sent depends upon the size of the sending window.
The receiver records the sequence number of the earliest incorrect or un-received frame. It then fills the receiving window with the subsequent frames that it has received. It sends the sequence number of the missing frame along with every acknowledgement frame.
The sender continues to send frames that are in its sending window. Once, it has sent all the frames in the window, it retransmits the frame whose sequence number is given by the acknowledgements. It then continues sending the other frames.
Sender Site Algorithm of Selective Repeat Protocol
Begin
Frame s; //s denotes frame to be sent
Frame t; //t is temporary frame
S_window = power(2,m-1); //Assign maximum window size
SeqFirst = 0; // Sequence number of first frame in window
SeqN = 0; // Sequence number of Nth frame window
While (true) //check repeatedly
Do
Wait_For_Event(); //wait for availability of packet
If ( Event(Request_For_Transfer)) then
//check if window is full
If (SeqN–SeqFirst >= S_window) then
DoNothing();
End if;
Get_Data_From_Network_Layer();
s = Make_Frame();
s.seq = SeqN;
Store_Copy_Frame(s);
Send_Frame(s);
Start_Timer(s);
SeqN = SeqN + 1;
End if;
If ( Event(Frame_Arrival) then
r = Receive_Acknowledgement();
//Resend frame whose sequence number is with ACK
If ( r.type = NAK) then
If ( NAK_No > SeqFirst && NAK_No < SeqN ) then
Retransmit( s.seq(NAK_No));
Start_Timer(s);
End if
//Remove frames from sending window with positive ACK
Else if ( r.type = ACK ) then
Remove_Frame(s.seq(SeqFirst));
Stop_Timer(s);
SeqFirst = SeqFirst + 1;
End if
End if
// Resend frame if acknowledgement haven’t been received
If ( Event(Time_Out)) then
Start_Timer(s);
Retransmit_Frame(s);
End if
End
Receiver Site Algorithm of Selective Repeat Protocol
Begin
Frame f;
RSeqNo = 0; // Initialise sequence number of expected frame
NAKsent = false;
ACK = false;
For each slot in receive_window
Mark(slot)=false;
While (true) //check repeatedly
Do
Wait_For_Event(); //wait for arrival of frame
If ( Event(Frame_Arrival) then
Receive_Frame_From_Physical_Layer();
If ( Corrupted ( f.SeqNo ) AND NAKsent = false) then
SendNAK(f.SeqNo);
NAKsent = true;
End if
If ( f.SeqNo != RSeqNo AND NAKsent = false ) then
SendNAK(f.SeqNo);
NAKsent = true;
If ( f.SeqNo is in receive_window ) then
If ( Mark(RSeqNo) = false ) then
Store_frame(f.SeqNo);
Mark(RSeqNo) = true;
End if
End if
Else
While ( Mark(RSeqNo))
Extract_Data(RSeqNo);
Deliver_Data_To_Network_Layer();
RSeqNo = RSeqNo + 1;
Send_ACK(RSeqNo);
End while
End if
End if
End while
End
Difference between the Go-Back-N ARQ and Selective Repeat ARQ
Go-Back-N ARQ | Selective Repeat ARQ |
If a frame is corrupted or lost in it,all subsequent frames have to be sent again. | In this, only the frame is sent again, which is corrupted or lost. |
If it has a high error rate,it wastes a lot of bandwidth. | There is a loss of low bandwidth. |
It is less complex. | It is more complex because it has to do sorting and searching as well. And it also requires more storage. |
It does not require sorting. | In this, sorting is done to get the frames in the correct order. |
It does not require searching. | The search operation is performed in it. |
It is used more. | It is used less because it is more complex. |
Point - to - Point Protocol (PPP) is a communication protocol of the data link layer that is used to transmit multiprotocol data between two directly connected (point-to-point) computers. It is a byte - oriented protocol that is widely used in broadband communications having heavy loads and high speeds. Since it is a data link layer protocol, data is transmitted in frames. It is also known as RFC 1661.
The main services provided by Point - to - Point Protocol are
- Defining the frame format of the data to be transmitted.
- Defining the procedure of establishing link between two points and exchange of data
- Stating the method of encapsulation of network layer data in the frame.
- Stating authentication rules of the communicating devices
- Providing address for network communication.
- Providing connections over multiple links
- Supporting a variety of network layer protocols by providing a range os services
Point - to - Point Protocol is a layered protocol having three components −
Encapsulation Component − It encapsulates the datagram so that it can be transmitted over the specified physical layer.
Link Control Protocol (LCP) − It is responsible for establishing, configuring, testing, maintaining and terminating links for transmission. It also imparts negotiation for set up of options and use of features by the two endpoints of the links.
Authentication Protocols (AP) − These protocols authenticate endpoints for use of services. The two authentication protocols of PPP are Password Authentication Protocol (PAP) Challenge Handshake Authentication Protocol (CHAP)
Network Control Protocols (NCPs) − These protocols are used for negotiating the parameters and facilities for the network layer. For every higher-layer protocol supported by PPP, one NCP is there.
Key takeaways
The main services provided by Point - to - Point Protocol are Defining the frame format of the data to be transmitted. Defining the procedure of establishing link between two points and exchange of data Stating the method of encapsulation of network layer data in the frame. Stating authentication rules of the communicating devices. Providing address for network communication. Providing connections over multiple links. Supporting a variety of network layer protocols by providing a range OS services.
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 transmit the data over the channel. It may create collisions and cross talk. Hence, the multiple access protocol is required to reduce the collision and avoid crosstalk between the channels.
For example, suppose that there is a classroom full of students. When a teacher asks a question, all the students (small channels) in the class start answering the question at the same time (transferring the data simultaneously). All the students respond at the same time due to which data overlap or data is lost. Therefore it is the responsibility of a teacher (multiple access protocol) to manage the students and give them one answer.
Following are the types of multiple access protocol that is subdivided into the different process as:
Fig 10: Types of multiple access protocol
A. Random Access Protocol
In this protocol, all the stations have the equal priority to send the data over a channel. In the random access protocol, one or more stations cannot depend on another station nor any station control another station. Depending on the channel's state (idle or busy), each station transmits the data frame. However, if more than one station sends the data over a channel, there may be a collision or data conflict. Due to the collision, the data frame packets may be lost or changed. And hence, it does not receive by the receiver end.
Following are the different methods of random-access protocols for broadcasting frames on the channel.
● Aloha
● CSMA
● CSMA/CD
● 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
- Any station can transmit data to a channel at any time.
- It does not require any carrier sensing.
- Collisions and data frames may be lost during the transmission of data through multiple stations.
- Acknowledgment of the frames exists in Aloha. Hence, there is no collision detection.
- It requires retransmission of data after some random amount of time.
Fig 11: Types of ALOHA
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 ends within the specified time, the station waits for a random amount of time, called the backoff 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.
- The total vulnerable time of pure Aloha is 2 * Tfr.
- Maximum throughput occurs when G = 1/ 2 that is 18.4%.
- 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.
- Maximum throughput occurs in the slotted Aloha when G = 1 that is 37%.
- The probability of successfully transmitting the data frame in the slotted Aloha is S = G * e ^ - 2 G.
- The total vulnerable time required in slotted Aloha is Tfr.
Difference Between Pure Aloha And Slotted Aloha-
Pure Aloha | Slotted Aloha |
Any station can transmit the data at any time. | Any station can transmit the data at the beginning of any time slot. |
The time is continuous and not globally synchronized. | The time is discrete and globally synchronized. |
Vulnerable time in which collision may occur = 2 x Tt | Vulnerable time in which collision may occur = Tt |
Probability of successful transmission of data packet = G x e-2G | Probability of successful transmission of data packet = G x e-G |
Maximum efficiency = 18.4% (Occurs at G = 1/2) | Maximum efficiency = 36.8% ( Occurs at G = 1) |
The main advantage of pure aloha is its simplicity in implementation. | The main advantage of slotted aloha is that it reduces the number of collisions to half and doubles the efficiency of pure aloha. |
Key takeaway
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.
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.
The slotted Aloha is designed to overcome the pure Aloha's efficiency because pure Aloha has a very high possibility of frame hitting.
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 is a network access mechanism for controlling network access on shared network topologies like Ethernet. Before sending, devices connected to the network cable listen (carrier sense). Devices wait before broadcasting if the channel is in use. Multiple Access (MA) refers to the ability for multiple devices to connect to and share the same network. When the network is clear, all devices have equal access to it.
To put it another way, a station that wishes to communicate first "listens" to media communication and then waits for a "quiet" of a certain length of time (called the Distributed Inter Frame Space or DIFS). Following this mandatory interval, the station begins a countdown for a random period.
The collision window is the maximum duration of this countdown (Window Collision, CW). If no equipment talks before the countdown ends, the station will just deliver the gift. If it is surpassed by another station, however, it immediately stops counting and waits for the next moment of stillness. She then picked up where his account countdown had left off. Figure summarizes this information. The random waiting time has the advantage of permitting a statistically equitable allocation of speaking time between the various network equipment while making it rare (but not impossible) that both devices speak at the same time.
The countdown method prevents a station from delaying the delivery of its cargo for too long. It's a little like what happens in a conference room where no master session (and everyone in the world is courteous) expects stillness before speaking, then a few moments before speaking, to give someone else a chance to talk. The time is allotted at random, which means that it is distributed fairly evenly.
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.
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) acknowledgment, 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:
Interframe 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:
- FDMA (Frequency Division Multiple Access)
- TDMA (Time Division Multiple Access)
- CDMA (Code Division Multiple Access)
Key takeaway
CSMA is a network access mechanism for controlling network access on shared network topologies like Ethernet.
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.
References:
- Peterson and Davie, “Computer Networks: A Systems Approach”, Morgan Kaufmann
- W. A. Shay, “Understanding Communications and Networks”, Cengage Learning.
- D. Comer, “Computer Networks and Internets”, Pearson.
- Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.