4th Sem CN Unit 3
4th Sem CN Unit 3
CONTENTS – Types of errors, framing (character and bit stuffing), Protocols: for Noiseless
Channels (Simplex, Stop and Wait), for Noisy Channels (Stop & wait ARQ, Go-Back- N ARQ,
Selective repeat ARQ), Point to Point (PPP), Multiple Access Protocol: Pure Aloha, Slotted
Aloha, CSMA, CSMA/CD, CSMA/CA.
Types of Errors
• Whenever bits flow from one point to another, they are subject to unpredictable
changes because of interference. This interference can change the shape of the signal.
In a single-bit error, a 0 is changed to a 1 or a 1 to a 0. In a burst error, multiple bits are
changed.
Single-bit errors are the least likely type of error in serial data transmission. To
understand why, imagine data sent at 1 Mbps. This means that each bit lasts only
1/1,000,000 s, or 1) ls. For a single-bit error to occur, the noise must have a duration
of only 1) ls, which is very rare; noise normally lasts much longer than this.
2) Burst Error- The term burst error means that 2 or more bits in the data unit have
changed from 1 to 0 or from 0 to 1. A burst error means that 2 or more bits in the data
unit have changed.
Figure shows the effect of a burst error on a data unit. In this case,
0100010001000011 was sent, but 0101110101100011 was received. Note that a
burst error does not necessarily mean that the errors occur in consecutive bits. The
length of the burst is measured from the first corrupted bit to the last corrupted bit.
Some bits in between may not have been corrupted. A burst error is more likely to
occur than a single-bit error. The duration of noise is normally longer than the
duration of 1 bit, which means that when noise affects data, it affects a set of bits. The
number of bits affected depends on the data rate and duration of noise. For example, if
we are sending data at 1 kbps, a noise of 11100 s can affect 10 bits; if we are sending
data at 1 Mbps, the same noise can affect 10,000 bits.
FRAMING –
• Framing in the data link layer 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, which is not normally done.
UNIT 3 – DATA LINK LAYER Page 2
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
• One reason is that 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. When a message is divided
into smaller frames, a single-bit error affects only that small frame.
• Breaking the bit stream up into frames is more difficult than it at first appears. One
way to achieve this framing is to insert time gaps between frames, much like the
spaces between words in ordinary text.
• However, networks rarely make any guarantees about timing, so it is possible these
gaps might be squeezed out or other gaps might be inserted during transmission.
• Since it is too risky to count on timing to mark the start and end of each frame, other
methods have been devised.
• Following methods are used for carrying methods:
i. Character count.
ii. Flag bytes with byte stuffing.
iii. Starting and ending flags, with bit stuffing.
i. Character count
• The first framing method uses a field in the header to specify the number of characters
in the frame.
• When the data link layer at the destination sees the character count, it knows how many
characters follow and hence where the end of the frame is.
• This technique is shown in Fig. A for four frames of sizes 5, 5, 8, and 8 characters,
respectively.
Fig. A character stream. (a) Without errors. (b) With one error.
• The trouble with this algorithm is that the count can be garbled by a transmission
error.
• For example, if the character count of 5 in the second frame of Fig. (b) becomes a 7, the
destination will get out of synchronization and will be unable to locate the start of the
next frame.
• Even if the checksum is incorrect so the destination knows that the frame is bad, it still
has no way of telling where the next frame starts.
• Sending a frame back to the source asking for a retransmission does not help either,
since the destination does not know how many characters to skip over to get to the
start of the retransmission. For this reason, the character count method is rarely used
anymore.
Figure1 - The design of the simplest protocol with no flow or error control
Figure2-Flow Diagram
• Comparing this figure3 with Figure1, we can see the traffic on the forward channel
(from sender to receiver) and the reverse channel. At any time, there is either one data
frame on the forward channel or one ACK frame on the reverse channel. We therefore
need a half-duplex link.
• Figure4 shows an example of communication using this protocol. It is still
very simple. The sender sends one frame and waits for feedback from the
receiver. When the ACK arrives, the sender sends the next frame. Note that
UNIT 3 – DATA LINK LAYER Page 7
Priyadarshini Bhagwati College of Engineering, Nagpur
Department of Computer Science & Engineering
B. E. 4TH Semester - CSE Subject – Computer Network
Subject Notes By – D. V. Jamthe
----------------------------------------------------------------------------------------------------------------------------------
sending two frames in the protocol involves the sender in four events and the
receiver in two events.
• The receive window makes sure that the correct data frames are received and that the
correct acknowledgments are sent. The size of the receive window is always 1. The
receiver is always looking for the arrival of a specific frame. Any frame arriving out of
order is discarded and needs to be resent. Figure shows the receive window.
• Note that it need only one variable Rn (receive window, next frame expected) to define
this abstraction. The sequence numbers to the left of the window belong to the frames
already received and acknowledged; the sequence numbers to the right of this window
define the frames that cannot be received.
• Any received frame with a sequence number in these two regions is discarded. Only a
frame with a sequence number matching the value of Rn is accepted and
acknowledged.
• The receive window also slides, but only one slot at a time. When a correct frame is
received (and a frame is received only one at a time), the window slides.
Timers
• Although there can be a timer for each frame that is sent, in our protocol we use only
one. The reason is that the timer for the first outstanding frame always expires first;
we send all outstanding frames when this timer expires.
Acknowledgment
POINT-TO-POINT PROTOCOL
• The Internet needs a point-to-point protocol for a variety of purposes, including
router to-router traffic and home user-to-ISP traffic.
• Although HDLC is a general protocol that can be used for both point-to-point and
multipoint configurations, one of the most common protocols for point-to-point access
is the Point-to-Point Protocol (PPP).
• Today, millions of Internet users who need to connect their home computers to the
server of an Internet service provider use PPP.
• The majority of these users have a traditional modem; they are connected to the
Internet through a telephone line, which provides the services of the physical layer.
But to control and manage the transfer of data, there is a need for a point-to-point
protocol at the data link layer.
• PPP is by far the most common. PPP handles error detection, supports multiple
protocols, allows IP addresses to be negotiated at connection time, permits
authentication, and has many other features.
• PPP provides several services:
1. PPP defines the format of the frame to be exchanged between devices.
2. PPP defines how two devices can negotiate the establishment of the link and
the exchange of data.
3. PPP defines how network layer data are encapsulated in the data link frame.
4. PPP defines how two devices can authenticate each other.
5. PPP provides multiple network layer services supporting a variety of
network layer protocols.
6. PPP provides connections over multiple links.
7. PPP provides network address configuration.
1. Flag. A PPP frame starts and ends with a 1-byte flag with the bit pattern
01111110.Although this pattern is the same as that used in HDLC, there is a big difference.
PPP is a byte-oriented protocol; HDLC is a bit-oriented protocol.
2. Address. The address field in this protocol is a constant value and set to 11111111
(broadcast address). During negotiation (discussed later), the two parties may agree to omit
this byte.
3. Control. This field is set to the constant value 11000000 (imitating unnumbered frames in
HDLC). PPP does not provide any flow control. Error control is also limited to error detection.
This means that this field is not needed at all, and again, the two parties can agree, during
negotiation, to omit this byte.
4. Protocol. The protocol field defines what is being carried in the data field: either user data
or other information. This field is by default 2 bytes long, but the two parties can agree to use
only 1 byte. The fourth PPP field is the Protocol field. Its job is to tell what kind of packet is in
the Payload field. Codes are defined for LCP, NCP, IP, IPX, AppleTalk, and other protocols.
Protocols starting with a 0 bit are network layer protocols such as IP, IPX, OSI CLNP, and XNS.
Those starting with a 1 bit are used to negotiate other protocols. These include LCP and a
different NCP for each network layer protocol supported.
6. FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.
1. Data link control – responsible for flow and error control called the logical link control
2. Medium Access resolution – responsible for multiple access resolution called the medium
access control.
• The need for multiple access protocols arises not only in communications systems but
also in many other systems such as a computer system, a storage facility or a server of
any kind, where a resource is shared (and thus accessed) by a number of independent
users.
• Following figure shows the categories of multiple access protocols;
1. ALOHA
2. Carrier Sense Multiple Access
3. Carrier Sense Multiple Access with Collision Detection
4. Carrier Sense Multiple Access with Collision Avoidance
1. ALOHA –
• The Aloha family of protocols is probably the richest family of multiple access
protocols.
• Its popularity is due first of all to seniority, as it is the first random access technique
introduced.
• Second, many of these protocols are so simple that their implementation is
straightforward.
• Many local area networks of today implement some sophisticated variants of this
family’s protocols.
• Pure ALOHA relies on acknowledgement from the receiver. If ACK not received after a
timeout period, the sender assumes that the frame is destroyed and resends the same.
• Collisions possible even during retransmissions. To solve this, pure ALOHA dictates
that after the time out passes, each station will wait for a random amount of time
called the back off time.
CSMA Protocols –
• Protocols in which stations listen for a carrier and act accordingly are called carrier
sense protocols. Following are the CSMA protocols (or techniques) –
Non-persistent CSMA –
• In this scheme, if a station wants to transmit a frame and it finds that the channel is
busy then it has to wait for fixed interval of time. After this time, it again checks the
status of the channel and if the channel is free then transmits.
1-persistent CSMA –
• In this scheme, the station which wants to transmit continuously monitors the channel
until it is idle and then transmits immediately.
• The disadvantages of this strategy are that if two stations transmit simultaneously a
collision takes place. Retransmission starts only after finding the channel free.
P-persistent CSMA –
• If the medium is idle, transmit with probability p, and delay for one time unit with
probability (1 – p) (time unit = length of propagation delay) If the medium is busy,
continue to listen until medium becomes idle, then go to Step 1 If transmission is
delayed by one time unit, continue with Step 1 The possibilities of such collisions and
retransmission are reduced in the persistent CSMA.
• In this scheme, all the waiting stations are not allowed to transmit simultaneously as
soon as the channel becomes idle. A station is assumed to be transmitting with
probability p. For example, if p=1/6 and if 6 stations are waiting then on an average,
only one station can transmit while others will wait.
• At time t 1, station A has executed its persistence procedure and starts sending the bits
of its frame.
• At time t2, station C has not yet sensed the first bit sent by A. Station C executes its
persistence procedure and starts sending the bits in its frame, which propagate both to
the left and to the right.
• The collision occurs sometime after time t2' Station C detects a collision at time t3
when it receives the first bit of A's frame. Station C immediately (or after a short time,
but we assume immediately) aborts transmission.
• Station A detects collision at time t4 when it receives the first bit of C's frame; it also
immediately aborts transmission.
• Looking at the figure, we see that A transmits for the duration t4 - tl; C transmits for
the duration t3 - t2' Later we show that, for the protocol to work, the length of any
frame divided by the bit rate in this protocol must be more than either of these
durations.
• At time t4, the transmission of A: s frame, though incomplete, is aborted; at time t3, the
transmission of B's frame, though incomplete, is aborted.
• Now that we know the time durations for the two transmissions, we can show a more
complete graph in Figure (b).
• Inter frame Space (IFS) First, collisions are avoided by deferring transmission even if
the channel is found idle. When an idle channel is found, the station does not send
immediately.
• It waits for a period of time called the inter frame space or IFS. Even though the
channel may appear idle when it is sensed, a distant station may have already started
transmitting.
• The distant station's signal has not yet reached this station. The IFS time allows the
front of the transmitted signal by the distant station to reach this station. If after the
IFS time the channel is still idle, the station can send, but it still needs to wait a time
equal to the contention time. The IFS variable can also be used to prioritize stations or
frame types. For example, a station that is assigned shorter IFS has a higher priority.