Datalink control(framing,protocols)
Transcript of Datalink control(framing,protocols)
BrAinY 4Presented to:- Ma’am Sumbal and class
Group MembersZUPASHSANAMARHABAGroup Leader HiRA
DATA LINK CONTROL:-FramingError control &flow controlsProtocolsNoiseless channelNoisy channel
Topics to be discussed:-
FRAMING Zupash Kiramat
FRAMINGThe data link layer needs to pack bits into frames. So that each frame is distinguishable from another.
TYPESFixed size framingVariable sized framing
•Data to be carried are of 8 bits character from a coding system such as ASCII. •The header carries the source and destination addresses and other control information .•Trailer which carries error detection or error correction redundant bits, are also multiple of 8 bits.• To separate one fame from the next an 8bits frame is added at the beginning and at the end of a frame.
Character oriented protocol:
A frame in character oriented protocol
Stuffing
11.10
Byte stuffing and unstuffing
Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text
Note:
11.12
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0 in the
data, so that the receiver does not mistakethe pattern 0111110 for a flag.
Note
Bit oriented protocol:
the data section of a frame is a sequence of bits to be Interpreted by the upper layer as text, graphic, audio, video and so on.
Figure shows a frame in a bit oriented protocol.
Bit stuffing and unstuffing
ERROR CONTROL AND FLOW CONTROL
PROTOCOLS
SANA AYUB
Data link control
The most important responsibilities of the data link layer are flow control and error control. Collectively, these functions are known as data link control.
Data link control=flow +error control
Flow control
Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.
Receiving device hasLimited speedLimited amount of memory. So the sending device must not send
frame at a rate faster than a receiving station can absorb them.
Error control
Error control includes both error control and error detection.
Allows reciever to inform the sender if a frame is lost or damaged during transmission and coordinates the retransmission of those frames by the sender.
Whenever an error is detected,specified frames are retransmitted.
PROTOCOLS:
Protocols
Now let us see how the data link layer can combine framing, flow control, and error control to achieve the delivery of data from one node to another. The protocols are normally implemented in software by using one of the common programming languages. To make our discussions language-free, we have written in pseudocode a version of each protocol that concentrates mostly on the procedure instead of delving into the details of language rules.
NOISELESS CHANNEL simplest protocol stop-and-wait protocol
MARHABA WAZIR
NOISELESS CHANNEL
1. NOISELESS CHANNEL
lets assume that we have an ideal channel in which no frames are lost, corrupted or duplicated.
We introduce two protocols for this type channel:
a. Simplest protocolb. STOP-and-WAIT protocol
The design of the simplest protocol with no flow or error control
Figure shows an example of communication using this protocol
a.Simplest protocol
It is very simple. The sender sends a sequence of frames
without even thinking about the receiver. To send three frames, three events occur at
the sender site and three events at the receiver site.
Note that the data frames are shown by tilted
boxes; the height of the box defines the transmission time difference between the first bit and the last bit in the frame.
Flow diagram for simplest protocol
b.STOP and WAIT Protocol
Stop-and-Wait Protocol
Simple tokens of ACK and flow control added
Stop-and-Wait Protocol flow diagram
Stop-and-Wait protocol
At most one packet in flight at any time.
Sender sends one packet. Reciver sends acknowledgment
packet when it receive data.
THINKING CORNERWhat type of a link we need here?(Simplex, half duplex, full duplex)
NOISY CHANNEL
1) Stop-and-wait ARQ2) Go-back-N ARQ3) Selective repeat ARQ
HIRA ANWAR
2.NOISEY CHANNEL
Noisy channel
Realistic• error can and will happen.• needs error control.
Mechanisms1) Stop-and-wait ARQ2) Go-back-N ARQ3) Selective repeat ARQ
STOP AND WAIT ARQ
FramesPacket Error Free Packet
Transmitter
Receiver
Information Frame
Control Frame
Timer is set after each frame transmission
38
Stop-and-Wait ARQ(Automatic Repeat reQuest Sender keeps a copy of sent frame
until successful delivery is ensured. Receiver responds with an ack when
it successfully receives a frame. Both data and ack frames must be
numbered. When sender does not receive an
ack within certain time, it assumes frame is lost, then retransmits the same frame.
39
Stop-and-Wait ARQ
1. Normal operation2. The frame is lost3. The ACK is lost4. The ACK is delayed
40
Flow Diagram: Normal Operation
Time
Sender Receiver
Time
Frame 0
ACK 1Frame 1
ACK 0
S = 0
S = 1
R = 0
R = 1
R = 0
Deliver
Deliver
41
Flow Diagram: Lost Frame
Time
Sender Receiver
Time
Frame 0
ACK 1
Frame 1
ACK 0
S = 0 R = 0
R = 1
R = 0
S = 1
Timeout
Frame 1
Deliver
Deliver
42
Flow Diagram: Delayed ACKSender Receive
r
Frame 0
ACK 1
ACK 0
S = 0 R = 0
R = 1
R = 0
Frame 0Timeout
S = 1
S = 0
R = 1
Frame 0 expected;
discard
Deliver
ACK 1Frame 1
Timeout Frame 1Deliver
THINKING CORNER: Why Data frames & ACK frames need to be sequentially numbered?
Need for Sequence Numbers
(a) Frame 1 lost
A
B
Frame 0
Frame 1
ACK
Frame 1
ACK
TimeTime-out
Frame 2
(b) ACK lostA
B
Frame 0
Frame 1
ACKFrame 1ACK
TimeTime-out
Frame 2ACK
45
Drawbacks of Stop-and-Wait ARQ After each frame sent the host must wait
for an ACK. inefficient use of bandwidth.
To improve efficiency ACK should be sent after multiple frames.
Alternatives: Sliding Window protocols1.Go-back-N ARQ2.Selective Repeat ARQ
46
Pipelining
One task begins before the other one ends. increases efficiency in transmission.
There is no pipelining in Stop-and-Wait ARQ.
In sliding window protocol pipelining is implemented.
Sliding window
The sliding window is an theoretical concept that defines the range of sequence numbers that is the concern of the sender and receiver.
2.GO BACK N ARQ (Automatic Repeat reQuest)
49
(sliding window protocol)Go-Back-N ARQ
Allows multiple frames to be sent before waiting for ACK. These frames must be numbered
differently. Frame numbers are called Sequence
numbers. Frames must be received in the
correct order. If a frame is lost, the lost frame and
all of the following frames must be retransmitted.
51
The name of Go-back-N: why? Re-sending frame
when the frame is damaged the sender goes back and sends a set of frames starting from the last one ACKn’d
the number of retransmitted frames is N
Example:
The window size is 4. A sender has sent frame 6 and the
timer expires for frame 3 (frame 3 not ACKn’d). The sender goes back and re-sends the frames 3, 4, 5 and 6.
Sequence numbers
Frame header contains m bits for sequence number.
That allows up to 2m different frame numbers.
We can repeat sequence numbers.
53
Sending Window
Sending more than one frame at once requires sender to buffer multiple frames. Known as "sending window" Any of these frames in the window can be
lost.
54
"Sliding" Window
Once the first frames in the window is ACKed ACKed frames are removed from the buffer More frames are transmitted Result: The window slides to the right
55
Receiving Window
Receiver expects one frame at a time
56
Go-back-N-Control variables-
S- holds the sequence number of the recently sent frame
SF – holds sequence number of the first frame in the window
SL – holds the sequence number of the last frame R – sequence number of the frame expected to be
received
57
Go-Back-N: Window Sizes
For m-bit sequence numbers. Send window size: at most 2m-1.
Up to 2m-1 frames can be sent without ACK.
Receive window size: 1 Frames must be received in order.
58
Go-Back-N: Normal Operation
59
Go-Back-N: Lost Frame
ACKs are cumulative
60
Go-back-N
Inefficient all out of order received packets are discarded
This is a problem in a noisy link many frames must be retransmitted ->
bandwidth consuming
Solution re-send only the damaged frames
Selective Repeat ARQ avoid unnecessary retransmissions
61
Thinking Corner
Stop-and-Wait is a special case of Go-Back-N. What is the send window size in Stop-
and-Wait?
SELECTIVE REPEAT ARQ
63
Selective Repeat ARQ
Go-Back-N always discards out-of-order frames Losing one frame may result in
retransmission of multiple frames Very inefficient in noisy link
Selective Repeat ARQ allows frames to be received out of order Therefore, receive window > 1
64
Send and Receive Windows
Sender and receiver share window space equally
For m-bit sequence numbers Send window: up to 2m-1
Receive window: up to 2m-1
65
Send Window
66
Receive Window
67
Negative ACK Used by receiver to indicate missing
frame
68
Selective Repeat: Window Size
69
PIGGY BACKING(Bidirectional Transmission) Data are transferred both ways ACK are "piggybacked" with data
frames
Queries??????
links
https://youtu.be/Ms1XEMZbjgM https://youtu.be/Cs8tR8A9jm8 https://youtu.be/ovEQhPCbSGI
THANK YOU