Unit –IV
Subject :principles of computer communications and networks
Regulation:r16
Data link layer
The second layer of the DLL is the osi model provides a service to the network layer using the services of
physical layer.
Some of the services of the DL provides to the network layer includes.
1.provisioning links between the network entities(generally these are adjacent nodes in a sub network)
2.framing,which involves partitioning data into frames and exchanging these data into frames
3.frame sequencing which involves maintaining the correct order of the frames as they are being
exchanged.
4.Establishing and maintaining an acceptable level of flow control as frames being exchanged across a
link.
5.detecting the errors in the physical layer which includes error notification but not error correction.
6.Selecting QOS parameters associated with specific transmission including ensuring that sufficient
bandwidth is available and that transmission delays(i.e latency) are predictable and guaranteed
THE IEEE AND THE DATA LINK LAYER
No traditionsl standards are developed for LANS.
So in February 1980 IEEE developed the LAN standards for both physical and the data link layer using the
OSI reference model.ISO and IEC(international electro technical commission) are based on IEEE
networking standards.
A list of these standards are provided.
IEEE 802.1—Architectural overview of LANS.
IEEE 802.2-Logical link control(describes transmission of nodes between the frames.)
IEEE 802.3-Defines CSMA/CD
IEEE 802.3C-10MBPS ETHERNET
IEEE802.3U-100 MBPS ETHERNET
IEEE 802.3Z-GIGABIT ETHERNET
IEEE 802.4-TOKEN BUS NETWORK
IEEE802.5-LOGICAL RING LAN.
IEEE 802.6-Defines MANS.
IEEE 802.7-DEFINES THE BROAD BAND LANS.
IEEE 802.9-DEFINES INTEGRATED DIGITAL AND VIDEO NETWORKING-ISLANS
IEEE 802.10-STANDARDS FOR INTEROPERABLE.
IEEE 802.11-WLANS
IEEE 802.12-DEMAND PRIORITY ACCESS METHOD.
IEEE 802.14 CABLE TV BASED BROAD BAND COMMUNICATION.
Logical link control sublayer has 2 sub functions.
1.LLC has several functions including framing,flow control and error control.
2.MAC layer provides medium access control management protocols for accessing a shared medium.
Logical link control sublayer
1.framing
2.flow control
3.error control
Framing:
Framing refers to the process of partitioning the bit stram into discrete units or blocks of data called
frames.
Specific formats and timing sequences exist for each LAN type.
By partioning the bit stream into frames framing enables sending and receiving machines to synchronize
the transmission and reception of data.
Framing also facilitates error detection and correction.
Once a bit stream is portioned into frames specific information about the contents of the frame is
computed and transmitted within a frame.
Using this information a receiving node can determine the integrity of the received frame.
One common framing procedure involves inserting flag characters before and after the transmission of
the data message
We will use the bit pattern 01111110 as our start-stop flags.
To distinguish the uniqueness of the start-stop flag bit pattern.
One way is bit stuffing
• Each frame begins and ends with a special bit pattern called a flag byte [01111110].
• Whenever sender data link layer encounters five consecutive ones in the data stream, it
automatically stuffs a 0 bit into the outgoing stream.
• When the receiver sees five consecutive incoming ones followed by a 0 bit, it automatically
destuffs the 0 bit before sending the data to the network layer.
•
Computer Networks: Bit and Byte Stuffing 15
Input Stream
Stuffed Stream
Unstuffed Stream
0110111111100111110111111111100000
01101111101100111110011111011111000000
0110111111100111110111111111100000
Stuffed bits
Bit Stuffing
General frame format of IEEE 802.3 frame
Synchronization consists
Preamble used for synchronization consists of seven identical bytes(56) bits
Each byte has the bit pattern 10101010.
The start frame delimiter which indicates the start of the frame of data consisting of bit pattern
10101011.
This is used as start-stop flag in IEEE 802.3.
The destination address is the hardware address of the receiving station-normally 48 bits.
The source address is the hardware address of the sending station-normally 48 bits.
The length count is 2-byte field that indicates the length of the data field that follows.
The data field contains the actual data of 46 and 1500 bytes.
The pad field contains the dummy data that pad the data field uptoits minimum length of 46 bytes.
CRC contains the information needed for error detection.
It is also called as FCs(frame check sequence)
Flow control
Flow control is the another function of the LLC sublayer refers to the process that controls the rate at
which data are exchanged between two nodes.
It involves a feed back mechanism that informs the source machine of the destination machines ability
to keep up with the current flow of the data transmission
A source node may not transmit until it gets permission from the destination machine.
Flow control is necessary because it is possible at a rate faster than the destination can receive and
process them.
This can happen when a source node is lightly loaded and the destination node is heavily loaded or if the
source node has a faster processor than that of the destination node.
If the server processing speed is much greater than the client then the server is able to transmit more
frames than the client can process them.
Stop and wait flow control protocol
▪ Sender keeps a copy of the last frame until it receives an acknowledgement.
▪ For identification, both data frames and acknowledgements (ACK) frames are numbered
alternatively 0 and 1.
▪ Sender has a control variable (S) that holds the number of the recently sent frame. (0 or 1)
▪ Receiver has a control variable ® that holds the number of the next frame expected (0 or 1).
▪ Sender starts a timer when it sends a frame. If an ACK is not received within a allocated time
period, the sender assumes that the frame was lost or damaged and resends it
▪ Receiver send only positive ACK if the frame is intact.
▪ ACK number always defines the number of the next expected frame
Sliding window flow control protocol
In sliding window method, multiple frames are sent by sender at a time before needing an
acknowledgment.
• Multiple frames sent by source are acknowledged by receiver using a single ACK frame.
Sliding Window
• Sliding window refers to an imaginary boxes that hold the frames on both sender and receiver side.
• It provides the upper limit on the number of frames that can be transmitted before requiring an
acknowledgment.
• Frames may be acknowledged by receiver at any point even when window is not full on receiver side.
• Frames may be transmitted by source even when window is not yet full on sender side.
• The windows have a specific size in which the frames are numbered modulo- n, which means they are
numbered from 0 to n-l. For e.g. if n = 8, the frames are numbered 0, 1,2,3,4,5,6, 7, 0, 1,2,3,4,5,6, 7, 0, 1,
The size of window is n-1. For e.g. In this case it is 7. Therefore, a maximum of n-l frames may
be sent before an acknowledgment.
• When the receiver sends an ACK, it includes the number of next frame it expects to receive.
For example in order to acknowledge the group of frames ending in frame 4, the receiver sends
an ACK containing the number 5. When sender sees an ACK with number 5, it comes to know
that all the frames up to number 4 have been received.
Sliding Window on Sender Side
• At the beginning of a transmission, the sender's window contains n-l frames.
• As the frames are sent by source, the left boundary of the window moves inward, shrinking the
size of window. This means if window size is w, if four frames are sent by source after the last
acknowledgment, then the number of frames left in window is w-4.
• When the receiver sends an ACK, the source's window expand i.e. (right boundary moves
outward) to allow in a number of new frames equal to the number of frames acknowledged by
that ACK.
• For example, Let the window size is 7 (see diagram (a)), if frames 0 through 3 have been sent
and no acknowledgment has been received, then the sender's window contains three frames -
4,5,6.
• Now, if an ACK numbered 3 is received by source, it means three frames (0, 1, 2) have been
received by receiver and are undamaged.
• The sender's window will now expand to include the next three frames in its buffer. At this
point the sender's window will contain six frames (4, 5, 6, 7, 0, 1). (See diagram (b)).
Sliding Window on Receiver Side
• At the beginning of transmission, the receiver's window contains n-1 spaces for frame but not the
frames.
• As the new frames come in, the size of window shrinks.
• Therefore the receiver window represents not the number of frames received but the number of
frames that may still be received without an acknowledgment ACK must be sent.
• Given a window of size w, if three frames are received without an ACK being returned, the number of
spaces in a window is w-3.
• As soon as acknowledgment is sent, window expands to include the number of frames equal to the
number of frames acknowledged.
• For example, let the size of receiver's window is 7 as shown in diagram. It means window contains
spaces for 7 frames.
• With the arrival of the first frame, the receiving window shrinks, moving the boundary from space 0 to
1. Now, window has shrunk by one, so the receiver may accept six more frame before it is required to
send an ACK.
• If frames 0 through 3 have arrived but have DOC been acknowledged, the window will contain three
frame spaces.
As receiver sends an ACK, the window of the receiver expands to include as many new placeholders as
newly acknowledged frames.
• The window expands to include a number of new frame spaces equal to the number of the most
recently acknowledged frame minus the number of previously acknowledged frame. For e.g., If window
size is 7 and if prior ACK was for frame 2 & the current ACK is for frame 5 the window expands by three
(5-2).
Therefore, the sliding window of sender shrinks from left when frames of data are sending. The sliding
window of the sender expands to right when acknowledgments are received.
• The sliding window of the receiver shrinks from left when frames of data are received. The sliding
window of the receiver expands to the right when acknowledgement is sent.
Error control
Error control refers to the process of guaranteeing reliable data delivery.
That is data received are identical to the data transmitted.
Two basic strategies exist for dealing with the errors.
The first one is error correction through retransmission involves just enough information in the data
stream so the receiving node can detect an error occurred during transmission.Once an error is detected
the receiving node can then request the sender to retransmit the unit of data.
The second method is autonomous error correction involves providing redudndant information in the
data stream so the destination node can detect and correct any erros automatically.
Both methods are the forms of error correction.
Error control using retransmission involves use of acks.
If the positive acks are received means frame received correctly.
If the negative acks are received means the frame is not received correctly.to guard the possibility of
lodt or destroyed frames,the DLL always supports timers.
If a frame or ack is lost the sending node limit eventually expires alerting it to retransmit the frame.using
the sequence nos we can identify the whether the frame is already received or not.
The concepts of error detection,ack and retransmission are collectively referred to as ARQ(automatic
repeat request)
1.stop and wait ARQ
• When a receiver receives a damaged frame, it discards it and keeps its value of R.
• After the timer at the sender expires, another copy of frame 1 is sent.
• Simplest flow and error control protocol
• Data frames and ACK frames are numbered alternately (0,1)
• When receiver sends ACK1: it acknowledges data frame 0 and is expecting data frame 1, ACK0
acknowledges data frame 1 and is expecting data frame 0
• Sequence Numbers are incremented modulo 2. 1+1 = 0 , and 0+1=1
• Receiver has a counter (R ) which hold the number of the expected frame to be received. R is
incremented by 1 modulo 2 when the expected frame is received.
• The sender keeps a counter (S ) which holds the number of the last transmitted frame. S is
incremented by 1 modulo 2 when the acknowledgement of the last transmitted frame is
received and the next frame is transmitted
◼ If the receiver detects an error in the frame it discards it
◼ If the receiver receives an out-of-order frame ( frame 0 instead of frame 1 or vice versa), it
knows that the expected frame is lost or damaged and discards the out-of-order frame and
resend the previous ACK
◼ If the sender receives an ACK with a different number than the current value of S+1, it discards
it
◼ The sending device keeps a copy of the last frame transmitted until it receives the right
acknowledgment (ACK) for the frame
◼ The sender starts a timer when it sends a frame. If an ACK is not received within the allocated
time, the sender assumes that the frame was lost or damaged and resends it
piggybacking
Go-Back-N ARQ
Go-Back-N ARQ is a specific instance of automatic repeat request(ARQ) protocol which is an error
recovery mechanism to provide reliability. objects with a span smaller than the structuring element.
It is a special type of sliding window protocol.
In this the sending process continues to send a number of frames specified by a window size even
without receiving an acknowledgement (ACK) packet from the receiver. removes perimeter pixels from
larger image objects.
In Go-Back-N ARQ, the size of the sender window must be less than N and the size of the receiver
window is always 1.
When the frame is damaged the sender goes back and sends a set of frames starting from the last one
AKn‘d.
The number of retransmitted frames is N.
Selective repeat ARQ
Only damaged and lost frames are retransmitted
ACK numbers refer to the last correctly received frame, not next frame expected!
If go-back-n window size is n-1, SR widow size must be at most n/2 (why?)
Damaged Frames:
After receiving a damaged frame, receiver sends a NAK and continues accepting other frames
Sender only retransmits the missing frame
15 -Winter 2006
ECE
ECE 766
Computer Interfacing and Protocols
21
Selective Repeat ARQ
Host A Host B
Data 0
NAK 3
Data 1
Data 2
Data 3
Data 4
Data 5
Error, discard
Data 3
Window size 7
Error in data frame 3
Data 6
Types of errors
Single bit errors:
In a single-bit error, only 1 bit in the data unit has changed.
Burst errors
A burst error means that 2 or more bits in the data unit have changed.
To detect or correct errors, we need to send extra (redundant) bits with data.
Cyclic Redundancy Check
CRC
Given a k-bit frame or message, the transmitter generates an n-bit sequence, known as a frame check
sequence (FCS), so that the resulting frame, consisting of (k+n) bits, is exactly divisible by some
predetermined number.
The receiver then divides the incoming frame by the same number and, if there is no remainder,
assumes that there was no error.
Medium access control sublayer
CSMA : Carrier Sense Multiple Access Protocols
1 – persistent CSMA
when a station is ready to send a frame , it senses the channel :
if busy : continuously sense it and waits for it to become free
if idle : sends it (with probability 1) ..hence the name 1 -persistent
if collision : waits for random time and tries again.
Nonpersistent CSMA.
Less greedy than 1 persistent , hence better channel utilization but longer delays
when a station is ready to send a frame , it senses the channel :
if busy : waits for random time rather than continuously sense it for the purpose of seizing it
if idle : sends it .
if collision : waits for random time and tries again
Carrier-sense multiple access with collision detection (CSMA/CD):
It is a media access control method used most notably in early Ethernet technology for local area
networking. It uses carrier-sensing to defer transmissions until no other stations are transmitting. This is
used in combination with collision detection in which a transmitting station detects collisions by sensing
transmissions from other stations while it is transmitting a frame. When this collision condition is
detected, the station stops transmitting that frame, transmits a jam signal, and then waits for a random
time interval before trying to resend the frame.
CSMA/CD is a modification of pure carrier-sense multiple access (CSMA). CSMA/CD is used to improve
CSMA performance by terminating transmission as soon as a collision is detected, thus shortening the
time required before a retry can be attempted.
CSMA/CA
CSMA/CA protocol is used in wireless networks because they cannot detect the collision so the only
solution is collision avoidance.
• CSMA/CA avoids the collisions using three basic techniques.
i) Interframe space
(ii) Contention window
(iii) Acknowledgements
1.Interframe Space (IFS)
• Whenever the channel is found idle, the station does not transmit immediately. It
waits for a period of time called interframe space (IFS).
• When channel is sensed to be idle, it may be possible that same distant station may
have already started transmitting and the signal of that distant station has not yet
reached other stations.
• Therefore the purpose of IFS time is to allow this transmitted signal to reach other
stations.
• If after this IFS time, the channel is still idle, the station can send, but it still needs to
wait a time equal to contention time.
• IFS variable can also be used to define the priority of a station or a frame.
2. Contention Window
• Contention window is an amount of time divided into slots.
• A station that is ready to send chooses a random number of slots as its wait time.
• The number of slots in the window changes according to the binary exponential back-
off strategy. It means that it is set of one slot the first time and then doubles each time
the station cannot detect an idle channel after the IFS time.
• This is very similar to the p-persistent method except that a random outcome defines
the number of slots taken by the waiting station.
• In contention window the station needs to sense the channel after each time slot.
• If the station finds the channel busy, it does not restart the process. It just stops the
timer & restarts it when the channel is sensed as idle.
3. Acknowledgement
• Despite all the precautions, collisions may occur and destroy the data.
• The positive acknowledgment and the time-out timer can help guarantee that receiver
has received the frame.
CSMA/CA Procedure:
Fig. Shows the flow chart explaining the principle of CSMA/CA.
This is the CSMA protocol with collision avoidance.
• The station ready to transmit, senses the line by using one of the persistent strategies.
• As soon as it find the line to be idle, the station waits for an IFG (Interframe gap)
amount of time.
• If then waits for some random time and sends the frame.
• After sending the frame, it sets a timer and waits for the acknowledgement from the
receiver.
• If the acknowledgement is received before expiry of the timer, then the transmission is
successful.
• But if the transmitting station does not receive the expected acknowledgement before
the timer expiry then it increments the back off parameter, waits for the back off time
and resenses the line.
TOKEN PASSING PROTOCOL
The permission is provided in the form of a special control frame called a token.
The node that possess the token may access the medium.
The principle of token passing protocol is simple.The node that possess the token may access the
medium.since the possession of token control access to the medium the possibility of contention is
eliminated.the absence of contention is the absence of collisions.
In token passing scheme, the stations are connected logically to each other in form of ring and access of
stations is governed by tokens.
A token is a special bit pattern or a small message, which circulate from one station to the next in the
some predefined order.
In Token ring, token is passed from one station to another adjacent station in the ring whereas incase of
Token bus, each station
uses the bus to send the token to the next station in some predefined order.
In both cases, token represents permission to send. If a station has a frame queued for transmission
when it receives the token, it can send that frame before it passes the token to the next station. If it has
no queued frame, it passes the token simply.
After sending a frame, each station must wait for all N stations (including itself) to send the token to
their neighbors and the other N – 1 stations to send a frame, if they have one.
There exists problems like duplication of token or token is lost or insertion of new station, removal of a
station, which need be tackled for correct and reliable operation of this scheme.
PCCN DATA LINK LAYER UNIT 4 NOTES

PCCN DATA LINK LAYER UNIT 4 NOTES

  • 1.
    Unit –IV Subject :principlesof computer communications and networks Regulation:r16 Data link layer The second layer of the DLL is the osi model provides a service to the network layer using the services of physical layer. Some of the services of the DL provides to the network layer includes. 1.provisioning links between the network entities(generally these are adjacent nodes in a sub network) 2.framing,which involves partitioning data into frames and exchanging these data into frames 3.frame sequencing which involves maintaining the correct order of the frames as they are being exchanged. 4.Establishing and maintaining an acceptable level of flow control as frames being exchanged across a link. 5.detecting the errors in the physical layer which includes error notification but not error correction. 6.Selecting QOS parameters associated with specific transmission including ensuring that sufficient bandwidth is available and that transmission delays(i.e latency) are predictable and guaranteed THE IEEE AND THE DATA LINK LAYER No traditionsl standards are developed for LANS. So in February 1980 IEEE developed the LAN standards for both physical and the data link layer using the OSI reference model.ISO and IEC(international electro technical commission) are based on IEEE networking standards. A list of these standards are provided. IEEE 802.1—Architectural overview of LANS. IEEE 802.2-Logical link control(describes transmission of nodes between the frames.) IEEE 802.3-Defines CSMA/CD IEEE 802.3C-10MBPS ETHERNET
  • 2.
    IEEE802.3U-100 MBPS ETHERNET IEEE802.3Z-GIGABIT ETHERNET IEEE 802.4-TOKEN BUS NETWORK IEEE802.5-LOGICAL RING LAN. IEEE 802.6-Defines MANS. IEEE 802.7-DEFINES THE BROAD BAND LANS. IEEE 802.9-DEFINES INTEGRATED DIGITAL AND VIDEO NETWORKING-ISLANS IEEE 802.10-STANDARDS FOR INTEROPERABLE. IEEE 802.11-WLANS IEEE 802.12-DEMAND PRIORITY ACCESS METHOD. IEEE 802.14 CABLE TV BASED BROAD BAND COMMUNICATION. Logical link control sublayer has 2 sub functions. 1.LLC has several functions including framing,flow control and error control. 2.MAC layer provides medium access control management protocols for accessing a shared medium. Logical link control sublayer 1.framing 2.flow control 3.error control
  • 3.
    Framing: Framing refers tothe process of partitioning the bit stram into discrete units or blocks of data called frames. Specific formats and timing sequences exist for each LAN type. By partioning the bit stream into frames framing enables sending and receiving machines to synchronize the transmission and reception of data. Framing also facilitates error detection and correction. Once a bit stream is portioned into frames specific information about the contents of the frame is computed and transmitted within a frame. Using this information a receiving node can determine the integrity of the received frame. One common framing procedure involves inserting flag characters before and after the transmission of the data message We will use the bit pattern 01111110 as our start-stop flags. To distinguish the uniqueness of the start-stop flag bit pattern. One way is bit stuffing • Each frame begins and ends with a special bit pattern called a flag byte [01111110]. • Whenever sender data link layer encounters five consecutive ones in the data stream, it automatically stuffs a 0 bit into the outgoing stream. • When the receiver sees five consecutive incoming ones followed by a 0 bit, it automatically destuffs the 0 bit before sending the data to the network layer.
  • 4.
    • Computer Networks: Bitand Byte Stuffing 15 Input Stream Stuffed Stream Unstuffed Stream 0110111111100111110111111111100000 01101111101100111110011111011111000000 0110111111100111110111111111100000 Stuffed bits Bit Stuffing General frame format of IEEE 802.3 frame Synchronization consists Preamble used for synchronization consists of seven identical bytes(56) bits Each byte has the bit pattern 10101010. The start frame delimiter which indicates the start of the frame of data consisting of bit pattern 10101011. This is used as start-stop flag in IEEE 802.3. The destination address is the hardware address of the receiving station-normally 48 bits. The source address is the hardware address of the sending station-normally 48 bits. The length count is 2-byte field that indicates the length of the data field that follows. The data field contains the actual data of 46 and 1500 bytes.
  • 5.
    The pad fieldcontains the dummy data that pad the data field uptoits minimum length of 46 bytes. CRC contains the information needed for error detection. It is also called as FCs(frame check sequence) Flow control Flow control is the another function of the LLC sublayer refers to the process that controls the rate at which data are exchanged between two nodes. It involves a feed back mechanism that informs the source machine of the destination machines ability to keep up with the current flow of the data transmission A source node may not transmit until it gets permission from the destination machine. Flow control is necessary because it is possible at a rate faster than the destination can receive and process them. This can happen when a source node is lightly loaded and the destination node is heavily loaded or if the source node has a faster processor than that of the destination node. If the server processing speed is much greater than the client then the server is able to transmit more frames than the client can process them. Stop and wait flow control protocol ▪ Sender keeps a copy of the last frame until it receives an acknowledgement. ▪ For identification, both data frames and acknowledgements (ACK) frames are numbered alternatively 0 and 1. ▪ Sender has a control variable (S) that holds the number of the recently sent frame. (0 or 1) ▪ Receiver has a control variable ® that holds the number of the next frame expected (0 or 1). ▪ Sender starts a timer when it sends a frame. If an ACK is not received within a allocated time period, the sender assumes that the frame was lost or damaged and resends it ▪ Receiver send only positive ACK if the frame is intact. ▪ ACK number always defines the number of the next expected frame
  • 6.
    Sliding window flowcontrol protocol In sliding window method, multiple frames are sent by sender at a time before needing an acknowledgment. • Multiple frames sent by source are acknowledged by receiver using a single ACK frame. Sliding Window • Sliding window refers to an imaginary boxes that hold the frames on both sender and receiver side. • It provides the upper limit on the number of frames that can be transmitted before requiring an acknowledgment. • Frames may be acknowledged by receiver at any point even when window is not full on receiver side. • Frames may be transmitted by source even when window is not yet full on sender side. • The windows have a specific size in which the frames are numbered modulo- n, which means they are numbered from 0 to n-l. For e.g. if n = 8, the frames are numbered 0, 1,2,3,4,5,6, 7, 0, 1,2,3,4,5,6, 7, 0, 1, The size of window is n-1. For e.g. In this case it is 7. Therefore, a maximum of n-l frames may be sent before an acknowledgment. • When the receiver sends an ACK, it includes the number of next frame it expects to receive. For example in order to acknowledge the group of frames ending in frame 4, the receiver sends an ACK containing the number 5. When sender sees an ACK with number 5, it comes to know that all the frames up to number 4 have been received.
  • 7.
    Sliding Window onSender Side • At the beginning of a transmission, the sender's window contains n-l frames. • As the frames are sent by source, the left boundary of the window moves inward, shrinking the size of window. This means if window size is w, if four frames are sent by source after the last acknowledgment, then the number of frames left in window is w-4. • When the receiver sends an ACK, the source's window expand i.e. (right boundary moves outward) to allow in a number of new frames equal to the number of frames acknowledged by that ACK. • For example, Let the window size is 7 (see diagram (a)), if frames 0 through 3 have been sent and no acknowledgment has been received, then the sender's window contains three frames - 4,5,6. • Now, if an ACK numbered 3 is received by source, it means three frames (0, 1, 2) have been received by receiver and are undamaged. • The sender's window will now expand to include the next three frames in its buffer. At this point the sender's window will contain six frames (4, 5, 6, 7, 0, 1). (See diagram (b)). Sliding Window on Receiver Side
  • 8.
    • At thebeginning of transmission, the receiver's window contains n-1 spaces for frame but not the frames. • As the new frames come in, the size of window shrinks. • Therefore the receiver window represents not the number of frames received but the number of frames that may still be received without an acknowledgment ACK must be sent. • Given a window of size w, if three frames are received without an ACK being returned, the number of spaces in a window is w-3. • As soon as acknowledgment is sent, window expands to include the number of frames equal to the number of frames acknowledged. • For example, let the size of receiver's window is 7 as shown in diagram. It means window contains spaces for 7 frames. • With the arrival of the first frame, the receiving window shrinks, moving the boundary from space 0 to 1. Now, window has shrunk by one, so the receiver may accept six more frame before it is required to send an ACK. • If frames 0 through 3 have arrived but have DOC been acknowledged, the window will contain three frame spaces. As receiver sends an ACK, the window of the receiver expands to include as many new placeholders as newly acknowledged frames. • The window expands to include a number of new frame spaces equal to the number of the most recently acknowledged frame minus the number of previously acknowledged frame. For e.g., If window size is 7 and if prior ACK was for frame 2 & the current ACK is for frame 5 the window expands by three (5-2). Therefore, the sliding window of sender shrinks from left when frames of data are sending. The sliding window of the sender expands to right when acknowledgments are received.
  • 9.
    • The slidingwindow of the receiver shrinks from left when frames of data are received. The sliding window of the receiver expands to the right when acknowledgement is sent.
  • 12.
    Error control Error controlrefers to the process of guaranteeing reliable data delivery. That is data received are identical to the data transmitted. Two basic strategies exist for dealing with the errors. The first one is error correction through retransmission involves just enough information in the data stream so the receiving node can detect an error occurred during transmission.Once an error is detected the receiving node can then request the sender to retransmit the unit of data.
  • 13.
    The second methodis autonomous error correction involves providing redudndant information in the data stream so the destination node can detect and correct any erros automatically. Both methods are the forms of error correction. Error control using retransmission involves use of acks. If the positive acks are received means frame received correctly. If the negative acks are received means the frame is not received correctly.to guard the possibility of lodt or destroyed frames,the DLL always supports timers. If a frame or ack is lost the sending node limit eventually expires alerting it to retransmit the frame.using the sequence nos we can identify the whether the frame is already received or not. The concepts of error detection,ack and retransmission are collectively referred to as ARQ(automatic repeat request) 1.stop and wait ARQ • When a receiver receives a damaged frame, it discards it and keeps its value of R. • After the timer at the sender expires, another copy of frame 1 is sent. • Simplest flow and error control protocol • Data frames and ACK frames are numbered alternately (0,1) • When receiver sends ACK1: it acknowledges data frame 0 and is expecting data frame 1, ACK0 acknowledges data frame 1 and is expecting data frame 0 • Sequence Numbers are incremented modulo 2. 1+1 = 0 , and 0+1=1 • Receiver has a counter (R ) which hold the number of the expected frame to be received. R is incremented by 1 modulo 2 when the expected frame is received. • The sender keeps a counter (S ) which holds the number of the last transmitted frame. S is incremented by 1 modulo 2 when the acknowledgement of the last transmitted frame is received and the next frame is transmitted
  • 14.
    ◼ If thereceiver detects an error in the frame it discards it ◼ If the receiver receives an out-of-order frame ( frame 0 instead of frame 1 or vice versa), it knows that the expected frame is lost or damaged and discards the out-of-order frame and resend the previous ACK ◼ If the sender receives an ACK with a different number than the current value of S+1, it discards it ◼ The sending device keeps a copy of the last frame transmitted until it receives the right acknowledgment (ACK) for the frame ◼ The sender starts a timer when it sends a frame. If an ACK is not received within the allocated time, the sender assumes that the frame was lost or damaged and resends it
  • 15.
    piggybacking Go-Back-N ARQ Go-Back-N ARQis a specific instance of automatic repeat request(ARQ) protocol which is an error recovery mechanism to provide reliability. objects with a span smaller than the structuring element. It is a special type of sliding window protocol. In this the sending process continues to send a number of frames specified by a window size even without receiving an acknowledgement (ACK) packet from the receiver. removes perimeter pixels from larger image objects. In Go-Back-N ARQ, the size of the sender window must be less than N and the size of the receiver window is always 1. When the frame is damaged the sender goes back and sends a set of frames starting from the last one AKn‘d. The number of retransmitted frames is N.
  • 16.
    Selective repeat ARQ Onlydamaged and lost frames are retransmitted ACK numbers refer to the last correctly received frame, not next frame expected! If go-back-n window size is n-1, SR widow size must be at most n/2 (why?) Damaged Frames: After receiving a damaged frame, receiver sends a NAK and continues accepting other frames Sender only retransmits the missing frame 15 -Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 21 Selective Repeat ARQ Host A Host B Data 0 NAK 3 Data 1 Data 2 Data 3 Data 4 Data 5 Error, discard Data 3 Window size 7 Error in data frame 3 Data 6
  • 17.
    Types of errors Singlebit errors: In a single-bit error, only 1 bit in the data unit has changed. Burst errors A burst error means that 2 or more bits in the data unit have changed. To detect or correct errors, we need to send extra (redundant) bits with data. Cyclic Redundancy Check
  • 18.
    CRC Given a k-bitframe or message, the transmitter generates an n-bit sequence, known as a frame check sequence (FCS), so that the resulting frame, consisting of (k+n) bits, is exactly divisible by some predetermined number. The receiver then divides the incoming frame by the same number and, if there is no remainder, assumes that there was no error.
  • 20.
    Medium access controlsublayer CSMA : Carrier Sense Multiple Access Protocols 1 – persistent CSMA when a station is ready to send a frame , it senses the channel : if busy : continuously sense it and waits for it to become free if idle : sends it (with probability 1) ..hence the name 1 -persistent if collision : waits for random time and tries again. Nonpersistent CSMA. Less greedy than 1 persistent , hence better channel utilization but longer delays when a station is ready to send a frame , it senses the channel : if busy : waits for random time rather than continuously sense it for the purpose of seizing it if idle : sends it . if collision : waits for random time and tries again
  • 21.
    Carrier-sense multiple accesswith collision detection (CSMA/CD): It is a media access control method used most notably in early Ethernet technology for local area networking. It uses carrier-sensing to defer transmissions until no other stations are transmitting. This is used in combination with collision detection in which a transmitting station detects collisions by sensing transmissions from other stations while it is transmitting a frame. When this collision condition is detected, the station stops transmitting that frame, transmits a jam signal, and then waits for a random time interval before trying to resend the frame. CSMA/CD is a modification of pure carrier-sense multiple access (CSMA). CSMA/CD is used to improve CSMA performance by terminating transmission as soon as a collision is detected, thus shortening the time required before a retry can be attempted.
  • 22.
    CSMA/CA CSMA/CA protocol isused in wireless networks because they cannot detect the collision so the only solution is collision avoidance. • CSMA/CA avoids the collisions using three basic techniques. i) Interframe space (ii) Contention window (iii) Acknowledgements 1.Interframe Space (IFS) • Whenever the channel is found idle, the station does not transmit immediately. It waits for a period of time called interframe space (IFS). • When channel is sensed to be idle, it may be possible that same distant station may have already started transmitting and the signal of that distant station has not yet reached other stations. • Therefore the purpose of IFS time is to allow this transmitted signal to reach other stations. • If after this IFS time, the channel is still idle, the station can send, but it still needs to wait a time equal to contention time. • IFS variable can also be used to define the priority of a station or a frame. 2. Contention Window • Contention window is an amount of time divided into slots. • A station that is ready to send chooses a random number of slots as its wait time. • The number of slots in the window changes according to the binary exponential back- off strategy. It means that it is set of one slot the first time and then doubles each time the station cannot detect an idle channel after the IFS time.
  • 23.
    • This isvery similar to the p-persistent method except that a random outcome defines the number of slots taken by the waiting station. • In contention window the station needs to sense the channel after each time slot. • If the station finds the channel busy, it does not restart the process. It just stops the timer & restarts it when the channel is sensed as idle. 3. Acknowledgement • Despite all the precautions, collisions may occur and destroy the data. • The positive acknowledgment and the time-out timer can help guarantee that receiver has received the frame. CSMA/CA Procedure: Fig. Shows the flow chart explaining the principle of CSMA/CA. This is the CSMA protocol with collision avoidance.
  • 24.
    • The stationready to transmit, senses the line by using one of the persistent strategies. • As soon as it find the line to be idle, the station waits for an IFG (Interframe gap) amount of time. • If then waits for some random time and sends the frame. • After sending the frame, it sets a timer and waits for the acknowledgement from the receiver. • If the acknowledgement is received before expiry of the timer, then the transmission is successful. • But if the transmitting station does not receive the expected acknowledgement before the timer expiry then it increments the back off parameter, waits for the back off time and resenses the line. TOKEN PASSING PROTOCOL The permission is provided in the form of a special control frame called a token. The node that possess the token may access the medium. The principle of token passing protocol is simple.The node that possess the token may access the medium.since the possession of token control access to the medium the possibility of contention is eliminated.the absence of contention is the absence of collisions. In token passing scheme, the stations are connected logically to each other in form of ring and access of stations is governed by tokens. A token is a special bit pattern or a small message, which circulate from one station to the next in the some predefined order. In Token ring, token is passed from one station to another adjacent station in the ring whereas incase of Token bus, each station uses the bus to send the token to the next station in some predefined order. In both cases, token represents permission to send. If a station has a frame queued for transmission when it receives the token, it can send that frame before it passes the token to the next station. If it has no queued frame, it passes the token simply. After sending a frame, each station must wait for all N stations (including itself) to send the token to their neighbors and the other N – 1 stations to send a frame, if they have one. There exists problems like duplication of token or token is lost or insertion of new station, removal of a station, which need be tackled for correct and reliable operation of this scheme.