Chapter 3-Part I
Chapter 3-Part I
• Flow control:
• Error control:
i. Framing
• separates a message from one source to a destination, or from other messages
to other destinations, by adding a sender address and a destination address.
• The destination address defines where the packet is to go; the sender address
helps the recipient acknowledge the receipt.
• Although the whole message could be packed in one frame, that is not
normally done.
reason:
• a frame can be very large, making flow and error control very inefficient.
• When a message is carried in one very large frame, even a single-bit error
would require the retransmission of the whole message.
Cont.
Frames can be of fixed or variable size
• Fixed-Size Framing:- In fixed-size framing, there is no need for defining
the boundaries of the frames; the size itself can be used as a delimiter.
• An example of this type of framing is the ATM wide-area network,
which uses frames of fixed size called cells.
• Variable-Size Framing:- variable-size framing is prevalent in local area
networks. In variable-size framing, we need a way to define the end of
the frame and the beginning of the next.
• Historically, two approaches were used for this purpose: a character-
oriented (byte) approach and a bit-oriented approach.
Cont.
Character-Oriented (byte-oriented) Protocols
• data to be carried are 8-bit characters from a coding system such as ASCII.
• The header, which normally carries the source and destination addresses and
other control information, and the trailer, which carries error detection or error
correction redundant bits, are also multiples of 8 bits.
• To separate one frame from the next, an 8-bit (1-byte) flag is added at the
beginning and the end of a frame.
• Character-oriented framing was popular when only text was exchanged by the
data link layers. The flag could be selected to be any character not used for text
communication.
Cont.
Bit-Oriented Protocols
• In a 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.
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 mistaken the pattern 0111110 for a
flag.
Cont.
• Note that even if we have a 0 after five 1s, we still stuff a 0. The 0 will be
removed by the receiver.
• This means that if the flag like pattern 01111110 appears in the data, it will
change to 011111010 (stuffed) and is not mistaken as a flag by the receiver.
• The real flag 0111110 is not stuffed by the sender and is recognized by the
receiver as a flag.
ii. Media Access control
• The data link layer can further be divided in to two layers:
• the upper sub-layer that is responsible for flow and error control is
called the logical link control (LLC) layer;
• the lower sub-layer that is mostly responsible for multiple access
resolution is called the media access control (MAC) layer
• When nodes or stations are connected and use a common link, called a
multipoint or broadcast link, we need a multiple-access protocol to
coordinate access to the link.
iii. 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.
• Flow control coordinates the amount of data that can be sent before receiving an
acknowledgment and is one of the most important duties of the data link layer.
• In most protocols, flow control is a set of procedures that tells the sender how much data
it can transmit before it must wait for an acknowledgment from the receiver.
• The flow of data must not be allowed to overwhelm the receiver. Any receiving device
has a limited speed at which it can process incoming data and a limited amount of
memory in which to store incoming data.
• The receiving device must be able to inform the sending device before those limits are
reached and to request that the transmitting device send fewer frames or stop
temporarily.
• Incoming data must be checked and processed before they can be used.
iv. Error control
• We need to build systems that are robust to errors in data.
• There is no way to guarantee that all bits will be sent uncorrupted.
• One way to cope with this is to detect errors and request that corrupted data
should be retransmitted.
• Detecting errors cannot be guaranteed either.
• We can at least make it extremely unlikely that errors will go
undetected.
Cont.
✓Detecting Errors
• Usually, noise levels are fairly low and most of the bits are received
correctly by the receiver.
• The question is, how can the receiver know when an error has
occurred?
• Because errors occur randomly, there is no way of knowing with
complete certainty if the data is correct.
• The best we can do is detect most errors.
• Even when we detect an error, the next question is: what to do about
it?
Cont.
Error Detection Process
• For a given frame of bits, additional bits that constitute an error-
detecting code are added by the transmitter.
• for a data block of k bits, the error-detecting algorithm yields an error-
detecting code of n – k bits, where (n – k) < k.
• The error-detecting code, also referred to as the check bits, is
appended to the data block to produce a frame of n bits,
• The receiver separates the incoming frame into the k bits of data and (n
– k) bits of the error-detecting code.
• The receiver performs the same error-detecting calculation on the data
bits and compares this value with the value of the incoming error-
detecting code.
• A detected error occurs if and only if there is a mismatch.
Cont.
Types of Error
• single bit errors
• only one bit altered
• caused by white noise
• burst errors
• contiguous sequence of 8 bits in which first, last and any number of
intermediate bits are in error
• caused by impulse noise or by fading in wireless
• effect is greater at higher data rates
1. Parity Checking (Vertical Redundancy Check (VRC))
• If the received character does not have an even (or odd) number of bits
then an error must have occurred.
• Both the sender and receiver must know which form of parity to use.
Cont.
• A far more effective way of detecting errors in a block of data is to use a Cyclic
Redundancy Code.
• In CRC, a number is mathematically calculated for a packet by its source computer,
and then recalculated by the destination computer.
• for block of k bits, transmitter generates an n-k bit frame check sequence (FCS)
• Transmits n bits which is exactly divisible by some predetermined number
• The receiver then divides the incoming frame by that number and, if there is no
remainder, assumes there was no error.
• Can state this procedure in three equivalent ways: modulo 2 arithmetic,
polynomials, and digital logic
1. Modulo 2 Arithmetic
➢uses binary addition with no carries, which is just the exclusive-OR
(XOR) operation.
➢Binary subtraction with no carries is also interpreted as the XOR
operation:
11.35
Normal response mode
Frames
o HDLC defines three types of frames:
→ information frames (I-frames)
→ supervisory frames (S-frames) and
→ unnumbered frames (V-frames)
o Each type of frame serves as an envelope for the transmission of a different type
of message.
o I-frames are used to transport user data and control information relating to user data
o S-frames are used only to transport control information
o V-frames are reserved for system management.
→ Information carried by V-frames is intended for managing the link itself
Frame Format
Each frame in HDLC may contain up to six fields:
✓ a beginning flag field
✓ an address field
✓ a control field
✓ an information field
✓ a frame check sequence (FCS) field and
✓ an ending flag field.
HDLC frames
Control field
o The control field determines the type of frame and defines its functionality
o Control field format for the different frame types
11.40
Error Correction
• correction of errors using an error-detecting code, requires that block of data be
retransmitted.
• For wireless applications this approach is inadequate for two reasons:
1. The bit error rate on a wireless link can be quite high, which would result in a
large number of retransmissions.
2. In some cases, especially satellite links, the propagation delay is very long
compared to the transmission time of a single frame. With a long data link, an
error in a single frame necessitates retransmitting many frames.
• Instead, it would be desirable to enable the receiver to correct errors in an incoming
transmission on the basis of the bits in that transmission.
• Error correction operates in a fashion similar to error detection but is capable of
correcting certain errors in a transmitted bit stream.
Error Correction Process
How Error Correction Works
• error correction works by adding redundancy to the transmitted
message.
• The redundancy makes it possible for the receiver to deduce what the
original message was, even in the face of a certain level of error rate.
• If we wish to transmit blocks of data of length k bits, we map each k-bit
sequence into a unique n-bit code-word, which differ significantly from
each other.
• Typically, each valid code-word reproduces the original k data bits and
adds to them (n – k) check bits to form the n-bit code-word.
Cont.
• Then if an invalid code-word is received, assume the valid code-word is
the one that is closest to it, and use the input bit sequence associated
with it.
• The ratio of redundant bits to data bits, (n – k)/k, is called the
redundancy of the code, and the ratio of data bits to total bits, k/n, is
called the code rate.
• The code rate is a measure of how much additional bandwidth is
required to carry data at the same data rate as without the code.
• For example, a code rate of 1/2 requires double the transmission
capacity of an uncoded system to maintain the same data rate.
Hamming Distance
➢ The Hamming distance between two bit patterns is the number of
dissimilar bits.
➢ It measures the minimum number of substitutions required to change one
string into the other, or the number of errors that transform one string into
the other.
➢ For example, the Hamming distance between 01000001 (‘A’) and
01000011 (‘C’) is 1 because there is only one dissimilar bit.
➢ One error in the wrong place can turn an ‘A’ into a ‘C’.
Cont.
➢ It would take two errors in the wrong place to turn an ‘A’ into a
‘B’.
➢At each instance, a station that has data to send uses a procedure defined by the
protocol to make a decision on whether or not to send.
➢This decision depends on the state of the medium (idle or busy). In other words,
each station can transmit when it desires on the condition that it follows the
predefined procedure, including the testing of the state of the medium.
Cont.
• In a random access method, each station has the right to the medium without being
controlled by any other station.
• However, if more than one station tries to send, there is an access conflict, collision-
and the frames will be either destroyed or modified.
• To avoid access conflict or to resolve it when it happens, each station follows a
procedure that answers the following questions:
When can the station access the medium?
How can the station determine the success or failure of the transmission?
The random access methods have evolved from a very interesting protocol known as ALOHA,
which used a very simple procedure called multiple access (MA).
The method was improved with the addition of a procedure that forces the station to sense the
medium before transmitting.
• This method later evolved into two parallel methods: carrier sense multiple access with
collision detection (CSMA/CD) and carrier sense multiple access with collision avoidance
(CSMA/CA).
➢Basic idea of this mechanism is a user can transmit the data whenever they want.
➢Sender can detect the collision if it doesn’t receive the acknowledgement from the
receiver.
Procedure for pure ALOHA protocol
Procedure for pure ALOHA protocol
• Under what conditions will the shaded packet arrive undamaged?
Vulnerable Period
2. Slotted ALOHA
• Divide time up into discrete intervals, each
corresponding to one packet.
• The vulnerable period is now reduced in half.
Vulnerable time for slotted ALOHA protocol
3. Carrier Sense Multiple Access (CSMA)
Protocols that listen for a carrier and act accordingly are called carrier sense
protocols.
Carrier sensing allows the station to detect whether the medium is currently being
used.
There are two variants of CSMA: CSMA/CD and CSMA/CA
The simplest CSMA scheme is for a station to sense the medium, sending packets
immediately if the medium is idle.
If the station waits for the medium to become idle it is called persistent otherwise
it is called non persistent.
Assumptions with CSMA Networks
1.Constant length packets
2.No errors, except those caused by collisions
3.Each host can sense the transmissions of all other
hosts
4.The propagation delay is small compared to the
transmission time
After a random time interval, the stations that collided attempt to transmit again.
If another collision occurs, the time intervals from which the random waiting time
is selected are increased step by step.
All data exchanges must be made through the primary device even when the
ultimate destination is a secondary device.
The primary device controls the link; the secondary devices follow its instructions.
It is up to the primary device to determine which device is allowed to use the
channel at a given time.
➢If the primary wants to receive data, it asks the secondary devices if
they have anything to send; this is called poll function.
➢If the primary wants to send data, it tells the secondary to get ready to
receive; this is called select function.
3. Token Passing
In this method, a special packet called a token circulates through the ring.
The possession of the token gives the station the right to access the channel and
send its data.
When a station has some data to send, it waits until it receives the token from its
predecessor.
It then holds the token and sends its data.
When the station has no more data to send, it releases the token, passing it to the
next logical station in the ring.
The station cannot send data until it receives the token again in the next round.
Cont…
Channelization protocols
• FDMA
→ the available bandwidth of the common channel is divided into bands
that are separated by guard bands.
• TDMA
→ the bandwidth is just one channel that is timeshared between
different stations.
• CDMA
→ one channel carries all transmissions simultaneously.