12. Flow control
• It is a technique that generally observes the proper flow of data from sender to
receiver. It is very essential because it is possible for sender to transmit data or
information at very fast rate and hence receiver can receive this information and
process it.
• This can happen only if receiver has very high load of traffic as compared to sender, or
if receiver has power of processing less as compared to sender.
• Flow control is basically a technique that gives permission to two of stations that are
working and processing at different speeds to just communicate with one another.
• Flow control in Data Link Layer simply restricts and coordinates number of frames or
amount of data sender can send just before it waits for an acknowledgement from
receiver.
• Flow control is actually set of procedures that explains sender about how much data or
frames it can transfer or transmit before data overwhelms receiver.
• The receiving device also contains only limited amount of speed and memory to store
data. This is why receiving device should be able to tell or inform the sender about
stopping the transmission or transferring of data on temporary basis before it reaches
limit. It also needs buffer, large block of memory for just storing data or frames until
they are processed.
13.
14. Flow Control
• Ensuring the sending entity does not overwhelm
the receiving entity
– Preventing buffer overflow
• Transmission time
– Time taken to emit all bits into medium
• Propagation time
– Time for a bit to traverse the link
18. Approaches to Flow Control :Flow Control is classified into
two categories:
• Feedback – based Flow Control :
– The sender transmits data or frames after it has received
acknowledgements from user.
• Rate – based Flow Control :
– The sender sends or transfers data at a faster speed to
the recipient and the recipient cannot receive data at
that speed. The built-in mechanisms in the protocol will
only limit the overall speed at which data or information
is being transferred or sent by the sender without any
feedback or acknowledgment from the receiver.
19. • Feedback – based Flow Control : In this control technique, sender
simply transmits data or information or frame to receiver, then
receiver transmits data back to sender and also allows sender to
transmit more amount of data or tell sender about how receiver is
processing or doing. This simply means that sender transmits data
or frames after it has received acknowledgements from user.
• Rate – based Flow Control : In this control technique, usually when
sender sends or transfer data at faster speed to receiver and
receiver is not being able to receive data at the speed, then
mechanism known as built-in mechanism in protocol will just limit
or restricts overall rate at which data or information is being
transferred or transmitted by sender without any feedback or
acknowledgement from receiver.
20. Techniques of Flow Control in Data
Link Layer d to control the flow of data
21. Stop and Wait
• Source transmits frame
• Destination receives frame and replies with
acknowledgement
• Source waits for ACK before sending next frame
• Destination can stop flow by not send ACK
• Works well for a few large frames
22. Fragmentation
• Large block of data may be split into small frames
– Limited buffer size
– Errors detected sooner (when whole frame received)
– On error, retransmission of smaller frames is needed
– Prevents one station occupying medium for long
periods
• Stop and wait becomes inadequate
23. 1. Stop-and-Wait Flow Control : This method is the easiest and simplest form of flow
control. In this method, basically message or data is broken down into various
multiple frames, and then receiver indicates its readiness to receive frame of data.
When acknowledgement is received, then only sender will send or transfer the next
frame. This process is continued until sender transmits EOT (End of Transmission)
frame. In this method, only one of frames can be in transmission at a time. It leads to
inefficiency i.e. less productivity if propagation delay is very much longer than the
transmission delay and Ultimately In this method sender sent single frame and
receiver take one frame at a time and sent acknowledgement(which is next frame
number only) for new frame.
Advantages –
This method is very easiest and simple and each of the frames is checked and
acknowledged well.
This method is also very accurate.
Disadvantages –
This method is fairly slow.
In this, only one packet or frame can be sent at a time.
24. Stop and Wait ARQ
• Characteristics
– Used in Connection-oriented communication.
– It offers error and flows control
– It is used in Data Link and Transport Layers
– Stop and Wait for ARQ mainly implements the
Sliding Window Protocol concept with Window
Size 1
25. • Useful Terms:
– Propagation Delay: Amount of time taken by a packet to make a
physical journey from one router to another router.
– Propagation Delay = (Distance between routers) / (Velocity of
propagation)
– RoundTripTime (RTT) = 2* Propagation Delay
– TimeOut (TO) = 2* RTT
– Time To Live (TTL) = 2* TimeOut. (Maximum TTL is 180 seconds)
26. Simple Stop and Wait
• Sender:
– Rule 1 : Send one data packet at a time.
– Rule 2 : end the next packet only after receiving
acknowledgement for the previous.
• Receiver:
– Rule 1 : Send acknowledgement after receiving and
consuming a data packet.
– Rule 2 : After consuming packet acknowledgement need to be
sent (Flow Control)
29. 2. Lost Acknowledgement:
After a timeout on the sender side, a long-delayed acknowledgement might be
wrongly considered as acknowledgement of some other recent packet.
3. Delayed Acknowledgement/Data:
30. Stop and Wait for ARQ (Automatic Repeat Request)
The above 3 problems are resolved by Stop and Wait for ARQ
(Automatic Repeat Request) that does both error control and
flow control.
33. Working of Stop and Wait for ARQ:
1) Sender A sends a data frame or packet with sequence number 0.
2) Receiver B, after receiving the data frame, sends an
acknowledgement with sequence number 1 (the sequence number
of the next expected data frame or packet)
There is only a one-bit sequence number that implies that both
sender and receiver have a buffer for one frame or packet only.
34.
35. Characteristics of Stop and Wait ARQ:
• It uses a link between sender and receiver as a half-duplex link
• Throughput = 1 Data packet/frame per RTT
• If the Bandwidth*Delay product is very high, then they stop and wait
for protocol if it is not so useful.
• The sender has to keep waiting for acknowledgements before
sending the processed next packet.
• It is an example of “Closed Loop OR connection-oriented “ protocols
• It is a special category of SWP where its window size is 1
• Irrespective of the number of packets sender is having stop and wait
for protocol requires only 2 sequence numbers 0 and 1
36. Constraints:
1. Stop and Wait ARQ has very less efficiency .
• Fixed by increasing window size.
• Improve better efficiency, Return N and Selective Repeat
Protocols are used.
2. Stop and Wait ARQ solves three main problems but creates a
big performance problem because the sender is always waiting
for an acknowledgment even if the next packet is ready to be
sent.
37. • Simple Implementation: Stop and Wait ARQ is a simple protocol that is easy
to implement in both hardware and software. - Requires no complex
hardware algorithms or components, making it a cheap and efficient option.
• Error Detection: Stop and Wait ARQ detects errors in the transmitted data by
using checksums or cyclic redundancy checks (CRC). If an error is detected,
the receiver sends a negative acknowledgment (NAK) to the sender,
indicating that the data needs to be retransmitted.
• Reliable: Stop and Wait ARQ ensures that the data is transmitted reliably and
in order.
• Flow Control: Stop and Wait ARQ flow can be used to control the speed at
which data is sent by the sender. This is useful in situations where the
receiver has limited buffer space or processing power.
• Backward Compatibility: Stop and Wait ARQ is compatible with many existing
systems and protocols, making it a popular choice for communication over
unreliable channels.
Advantages of Stop and Wait ARQ :
38. 1. Low Efficiency: Stop and Wait ARQ has low efficiency as it requires the sender
to wait for an acknowledgment from the receiver before sending the next data
packet. This results in a low data transmission rate, especially for large data
sets.
2. High Latency: Stop and Wait ARQ introduces additional latency in the
transmission of data, as the sender must wait for an acknowledgment before
sending the next packet. This can be a problem for real-time applications such
as video streaming or online gaming.
3. Limited Bandwidth Utilization: Stop and Wait ARQ does not utilize the available
bandwidth efficiently, as the sender can transmit only one data packet at a
time. This results in underutilization of the channel, which can be a problem in
situations where the available bandwidth is limited.
4. Limited Error Recovery: Stop and Wait ARQ has limited error recovery
capabilities. If a data packet is lost or corrupted, the sender must retransmit the
entire packet, which can be time-consuming and can result in further delays.
5. Vulnerable to Channel Noise: Stop and Wait ARQ is vulnerable to channel noise,
which can cause errors in the transmitted data. This can result in frequent
retransmissions and can impact the overall efficiency of the protocol.
Disadvantages of Stop and Wait ARQ :
40. Sliding Windows Flow Control
• Allow multiple frames to be in transit
• Receiver has buffer W long
• Transmitter can send up to W frames without
ACK
• Each frame is numbered
• ACK includes number of next frame expected
• Sequence number bounded by size of field (k)
– Frames are numbered modulo 2k
43. Sliding Window Enhancements
• Receiver can acknowledge frames without
permitting further transmission (Receive Not
Ready)
• Must send a normal acknowledge to resume
• If duplex, use piggybacking
– If no data to send, use acknowledgement frame
– If data but no acknowledgement to send, send last
acknowledgement number again, or have ACK
valid flag (TCP)
44. Go-Back-N ARQ
• Stop and wait ARQ mechanism does not utilize
the resources at their best.
• When the acknowledgement is received, the
sender sits idle and does nothing.
• In Go-Back-N ARQ method, both sender and
receiver maintain a window.
45. • The sending-window size enables
the sender to send multiple
frames without receiving the
acknowledgement of the
previous ones.
• The receiving-window enables
the receiver to receive multiple
frames and acknowledge them.
• The receiver keeps track of
incoming frame’s sequence
number.
• The sender sends all the frames in
window, it checks up to what sequence
number it has received positive
acknowledgement.
• If all frames are positively
acknowledged, the sender sends next
set of frames.
• If sender finds that it has received NACK
or has not receive any ACK for a
particular frame, it retransmits all the
frames after which it does not receive
46.
47. Selective Repeat ARQ
• In Go-back-N ARQ, it is assumed that the
receiver does not have any buffer space for its
window size and has to process each frame as
it comes.
• This enforces the sender to retransmit all the
frames which are not acknowledged.
48. • In Selective-Repeat ARQ, the
receiver while keeping track of
sequence numbers, buffers the
frames in memory and sends NACK
for only frame which is missing or
damaged.
• The sender in this case, sends only
packet for which NACK is received.
49. Sliding Window Flow Control
Advantages
• It performs much better than stop-and-wait flow control.
• This method increases efficiency.
• Multiples frames can be sent one after another.
• Disadvantages –
• The main issue is complexity at the sender and receiver due to the
transferring of multiple frames.
• The receiver might receive data frames or packets out the
sequence.
50. Problem
• Ukuran windows 8, gambarkan diagram waktu
pengiriman Frame, asumsikan fran ke 5 tidak
sampai di penerima, bila menggunakan :
– Stop and wait ARQ....Apakah ini memerlukan
window ?
– Sliding Windows G back N
– Sliding Windows Selective Repeat
51. Error Detection
• Additional bits added by transmitter for error
detection code
• Parity
– Value of parity bit is such that character has even
(even parity) or odd (odd parity) number of ones
– Even number of bit errors goes undetected
52. Cyclic Redundancy Check
• For a block of k bits transmitter generates n
bit sequence
• Transmit k+n bits which is exactly divisible by
some number
• Receive divides frame by that number
– If no remainder, assume no error
– For math, see Stallings chapter 7
53. Error Control
o Data errors occur because electromagnetic wave
signals are disrupted due to heat, magnetism,
and other forms of electricity.
o Error control is needed to prevent error sending
messages to a higher level in the communication
hierarchy.
o The probability of a bit experiencing an error is
called the Bit Error Rate (BER).
o for example: 10 -6 means that in 1 million bits sent
there is 1 bit error.
54. Error Control
• Detection and correction of errors
• Lost frames
• Damaged frames
• Automatic repeat request
– Error detection
– Positive acknowledgment
– Retransmission after timeout
– Negative acknowledgement and retransmission
55. Techniques for Error Control
There are various techniques of error control as given
below :
56. Type of Errors
1. Single-bit error: 0 1 or 1 0
2. Burst error: Multiple bits are changed
57. Error Control Mechanism
1. Forward Error Control
2. Backward Error Control .
• FEC: additional information is sent to the receiver to be used to
detect errors and correct errors at once.
• Backward Error Control: only used to detect errors, error
correction is done by retransmitting data that causes errors.
58. Stop and Wait
Characteristics
• Used in Connection-oriented communication.
• It offers error and flows control
• It is used in Data Link and Transport Layers
• Stop and Wait for ARQ mainly implements the Sliding Window Protocol concept with
Window Size 1
• Useful Terms:
– Propagation Delay: Amount of time taken by a packet to make a physical journey from one router to
another router.
– Propagation Delay = (Distance between routers) / (Velocity of propagation)
– RoundTripTime (RTT) = 2* Propagation Delay
– TimeOut (TO) = 2* RTT
– Time To Live (TTL) = 2* TimeOut. (Maximum TTL is 180 seconds)
60. Error Detection Method
• The error detection method consists of four
types of redundancy checks, namely VRC, LRC,
CRC and Checksum
• The first three types are used in the data link
layer, while Checksum is on the higher layer.
62. VRC Performance
• VRC can check all single bits of an error.
– In the case of even-parity checking, VRC can
detect burst errors if the number of total errors in
each unit of data is odd.
64. LRC mechanism
• One bit block is divided into several rows and
added with one redundant row (LRC)
• The content of LRC is a sum of modulo two.
• In the recipient is done again, if LRC 0, there is
no error
65. Performa LRC
• LRC meningkatkan kemampuan pendeteksian
burst errors,
• LRC dengan n bit dapat mendeteksi burst error
n bit
71. Checksum
• Using the Complementary System 1
• Invert every 1 to 0 and 0 to 1
• A and -A are complement 1 of the others
• +A=1010 -A=0101
• +0 = 0000 -0 = 1111
74. Performa Checksum
• Contoh-contoh no error dan a burst error
• Segment 1 10101001
• Segment2 00111001
• Checksum 00011101
• --------------------------------- --------------------------------
• Sum 11111111 Sum 11000110
• Complement 00000000 Complement 00111001
Segment 1 10101111
Segment2 11111001
Checksum 00011101
75. • Error tidak terdeteksi bila pembalikan bit
diimbangi oleh an opposite bit inversion pada
digit yang berhubungan pada segmen lain.
• Segment 1 10111101 10101001
• Segment2 00101001 00111001
• Checksum 00011001
• ---------------------------------
• Sum 11111111 Error tidakterdeteksi
76. Error Correction
• Error correction requires more bit redundancy
than error detection.
– For example one extra bit can detect single-bit errors
(Parity bit in VRC)
• Bit redundancy is used to determine the location
of the bit that is experiencing an error.
– For example for 7-bit data, 8 conditions are needed,
namely 7 conditions for location and one condition for
no errors, so three bits of redundancy are needed.
77. 1. Hamming Code
• Hamming code is a set of error-correction codes
that can be used to detect and correct the errors
that can occur when the data is moved or stored
from the sender to the receiver.
• It is a technique developed by R.W. Hamming for
error correction.
• Redundant bits – Redundant bits are extra binary
bits that are generated and added to the
information-carrying bits of data transfer to ensure
that no bits were lost during the data transfer.
78. Terminology
1. Codeword is a word formed by data bits and
additional bits for check bits.
2. Hamming distance, is the minimum number of
bit positions in the sending and receiving code
words.
1. Bila hamming distance = n tidak dapat mendeteksi
n bit errors.
• For example parity bits, with a hamming distance, n
= 2 cannot detect data that has a 2-bit error.
Example: 0000000 0 0000011 0
79. Parity bit
• A parity bit is a bit appended to a data of binary bits to ensure that the total
number of 1’s in the data is even or odd.
• Parity bits are used for error detection.
• There are two types of parity bits:
– Even parity bit: In the case of even parity, for a given set of bits, the number of 1’s
are counted. If that count is odd, the parity bit value is set to 1, making the total
count of occurrences of 1’s an even number. If the total number of 1’s in a given set
of bits is already even, the parity bit’s value is 0.
– Odd Parity bit – In the case of odd parity, for a given set of bits, the number of 1’s
are counted. If that count is even, the parity bit value is set to 1, making the total
count of occurrences of 1’s an odd number. If the total number of 1’s in a given set
of bits is already odd, the parity bit’s value is 0.
80. 10.
Let us find the Hamming distance between two pairs of
words.
1. The Hamming distance d(000, 011) is 2 because
Example
2. The Hamming distance d(10101, 11110) is 3 because
82. 10.
Find the minimum Hamming distance of
the coding scheme in Table 10.1.
Solution
We first find all Hamming distances.
Example
The dmin in this case is 2.
83. 10.
Find the minimum Hamming distance of the coding
scheme in Table
Solution
We first find all the Hamming distances.
The dmin in this case is 3.
Example
85. 10.
To guarantee the detection of up to s
errors in all cases, the minimum
Hamming distance in a block
code must be dmin = s + 1.
Note
86. • The number of redundant bits can be
calculated using the following formula:
– 2^r ≥ m + r + 1
– where, r = redundant bit, m = data bit
• Suppose the number of data bits is 7, then the
number of redundant bits can be calculated
using:
• 2^4 ≥ 7 + 4 + 1 Thus, the number of redundant
bits= 4 Parity bits.
87. General Algorithm of Hamming code
Hamming Code is simply the use of extra parity bits to allow the identification of an error.
1. Write the bit positions starting from 1 in binary form (1, 10, 11, 100, etc).
2. All the bit positions that are a power of 2 are marked as parity bits (1, 2, 4, 8, etc).
3. All the other bit positions are marked as data bits.
4. Each data bit is included in a unique set of parity bits, as determined its bit position in binary form. a. Parity bit 1
covers all the bits positions whose binary representation includes a 1 in the least significant position (1, 3, 5, 7, 9,
11, etc). b. Parity bit 2 covers all the bits positions whose binary representation includes a 1 in the second position
from the least significant bit (2, 3, 6, 7, 10, 11, etc). c. Parity bit 4 covers all the bits positions whose binary
representation includes a 1 in the third position from the least significant bit (4–7, 12–15, 20–23, etc). d. Parity bit
8 covers all the bits positions whose binary representation includes a 1 in the fourth position from the least
significant bit bits (8–15, 24–31, 40–47, etc). e. In general, each parity bit covers all bits where the bitwise AND of
the parity position and the bit position is non-zero.
5. Since we check for even parity set a parity bit to 1 if the total number of ones in the positions it checks is odd.
6. Set a parity bit to 0 if the total number of ones in the positions it checks is even.
88.
89. 7. Determining the position of redundant bits
8. These redundancy bits are placed at positions that correspond to
the power of 2.
As in the above example:
• The number of data bits = 7
• The number of redundant bits = 4
• The total number of bits = 11
• The redundant bits are placed at positions corresponding to power
of 2
– 1, 2, 4, and 8
90. Suppose the data to be transmitted is 1011001, the bits will be placed
as follows:
Determining the Parity bits:
R1 bit is calculated using parity check at all the bits positions
whose binary representation includes a 1 in the least significant
position. R1: bits 1, 3, 5, 7, 9, 11
91. • To find the redundant bit R1, we check for even parity. Since the
total number of 1’s in all the bit positions corresponding to R1 is
an even number the value of R1 (parity bit’s value) = 0
• R2 bit is calculated using parity check at all the bits positions
whose binary representation includes a 1 in the second position
from the least significant bit. R2: bits 2,3,6,7,10,11
To find the redundant bit R2, we check for even parity. Since
the total number of 1’s in all the bit positions corresponding
to R2 is odd the value of R2(parity bit’s value)=1
92. R4 bit is calculated using parity check at all the bits positions whose binary
representation includes a 1 in the third position from the least significant
bit. R4: bits 4, 5, 6, 7
93. To find the redundant bit R4, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R4 is odd the value of
R4(parity bit’s value) = 1
R8 bit is calculated using parity check at all the bits positions whose
binary representation includes a 1 in the fourth position from the
least significant bit. R8: bit 8,9,10,11
94. To find the redundant bit R8, we check for even parity. Since the total
number of 1’s in all the bit positions corresponding to R8 is an even
number the value of R8(parity bit’s value)=0. Thus, the data transferred
is:
The bits give the binary number 0110 whose decimal representation is
6. Thus, bit 6 contains an error. To correct the error the 6th bit is
changed from 1 to 0.
95. Error detection and correction: Suppose in the above example the 6th
bit is changed from 0 to 1 during data transmission, then it gives new
parity values in the binary number:
The bits give the binary number 0110 whose decimal
representation is 6. Thus, bit 6 contains an error. To correct the
error the 6th bit is changed from 1 to 0.
98. Convolutional Codes
• Pada metoda ini aliran bit kontinyu sumber
dikodekan secara terus menerus, setiap bit
dikonvolusi dan akan menghasilkan symbols,
yang tergantung pada bit saat ini dan urutan
bit sebelumnya.
99.
100. • Teknik yang digunakan untuk menentukan
urutan output adalah :
– tree diagram
– state diagram
– trellis diagram
106. Misalkan ada sebuah packet dalam binary: 1110-
1011-0001-10 yang dikirim menggunakan hamming
code 4 bit. Tentukan apakah packet tersebut
mengandung error, jika iya, tentukan posisi errornya,
dan perbaiki isi paket tersebut.
SOAL
108. 1. Framing : Pembungkusan datagram ke bentuk frame sebelum ditransmisikan.
2. Physical Address, menambahkan sebuah header dimuka frame untuk mendefinisikan
pengirim dan penerima.
3. Flow Control : karena keterbatasan Buffer pada node, layer link memastikan
pengiriman frame tidak lebih cepat dari pada pemrosesan frame pada receiver.
Apabila bit rate berlebihan atau juga menurun maka flow control akan melakukan
tindakan yang menstabilkan bit rate.
4. Access Control : erangkat yang terhubung dengan link yang sama, lapisan data link
akan menentukan perangkat mana yang akan di kontrol pada saat tertentu.
5. Link Accsess : Link akses ini berhubungan dengan protokol kontrol akses media yang
mengatur bagaimana frame dikirimkan ke tautan.
6. Reliable Delivery : Reliable Delivery ini merupakan pengiriman yang handal menjamin
pengiriman datagram melalui link tanpa error.
7. Error Control : Agar layanan layer reliability, maka dilakukan penambahan mekanisme
deteksi dan transmisi ulang frame yang gagal.
1. Error Detection mendeteksi bit error karena atenuasi sinyal pada link, namun
hal ini tidak meminta frame reset dan frame yang salah akan dibuang.
2. Error Corection : memberikan layanan koreksi error.
Kesimpulan Layanan Link Layer pada Data Link :