CH 4 Data Link Layer 2
CH 4 Data Link Layer 2
4.1 INTRODUCTION
● The Data Link Layer is the second layer in the OSI model, above the Physical Layer,
which ensures that the error free data is transferred between the adjacent nodes in
the network.
● It breaks the datagram passed down by above layers and converts them into frames
ready for transfer. This is called Framing.
● It provides following two main functionalities:
1. Reliable data transfer service between two peer network layers.
2. Flow Control mechanism which regulates the flow of frames such that data
congestion is not there at slow receivers due to fast senders.
● So Data link layer has two sub-layers:
1. Logical Link Control (LLC): It deals with protocols, flow-control, and error control.
2. Media Access Control (MAC): It deals with actual control of media.
4.2 FRAMING
● Data link layer is intermediate between network layer and physical layer.
● To provide service to the network layer, the data link layer must use the service
provided to it by the physical layer.
● Physical layer accepts raw bit stream which is not guaranteed to be error free, and
attempt it to deliver it to the destination.
● So it is the responsibility of data link layer to detect errors such as number of bits
received may be less or contain different values etc.
Computer Networks (BCA Science - III) Data Link Layer
● The data link layer breaks the bit stream into the frames and compute checksum for
each frame. When frame comes at destination, the checksum is recomputed, if it is
different, an error has occurred and it will be corrected.
4.2.1 Framing Concept
● A frame is a digital data transmission unit in computer networking.
● The data link layer divides the continuous bit stream that physical layer uses into units
called frames, and computes the checksum for each frame and puts it as a field called
Frame Check Sequence (FCS) in the frame format, i.e. the way bits are organized in the
frame.
● At the destination, the checksum is recomputed when the frame arrives. This
facilitates error detection.
● Recognizing the frame boundaries as a synchronous bit pattern arrives is called
framing.
● The data link layer accepts the bit stream from the physical layer and breaks it into
frames, this process is known as framing.
● Fig. 4.1 shows frame format in data link layer.
Destination Control Error checking
Address Information Information
4.2
Computer Networks (BCA Science - III) Data Link Layer
Fig. 4.2: A Character Stream (a) Without Error, (b) With One Error
● So in case of any error, the entire data has to be retransmitted. But 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.
4.2.2.2 Flag Bytes with Byte Stuffing
● This method solves the problem of resynchronization.
● Each frame start and end with special bytes called flag byte.
● The flag byte is used as starting and ending delimiter as shown in Fig. 4.3.
ESC byte is inserted just before each accidental flag byte in the data. The data link
layer on the receiving end remove the escape byte before the data are given to the
network layer. This is known as byte stuffing or character stuffing.
● A major drawback is it uses 8-bit characters. Not all character codes use 8-bit
characters. Unicode uses 16-bit characters. So, it cannot be used for arbitrary sized
characters.
4.2.2.3 Starting and Ending Flags with Bit Stuffing
● In this method, it allows character codes with an arbitrary number of bits per
character. Each frame begins and ends with a special bit pattern, 01111110.
● Whenever the sender's data link layer-encounters a five consecutive 1s in the data, it
automatically stuffs a 0-bit into the outgoing bit stream. So this is bit stuffing.
● When receiver sees 5 consecutive 1-bit followed by a 0-bit, it automatically destuffs the
0-bit.
● If the user data contain the flag pattern, 01111110, this is transmitted as 011111010 but
stored in the receiver's memory as 01111110.
● With bit stuffing, the boundary between two frames can be unambiguously recognized
by the flag pattern. Thus, if the receiver loses track of where it is, all it has to do is scan
the input for flag sequences, since they can only occur at frame boundaries and never
within the data.
● The Fig. 4.4 shows the bit stuffing.
Fig. 4.4: (a) Original Data (b) The Data Appear on the Line
(c) The Data at Receivers Site
4.4
Computer Networks (BCA Science - III) Data Link Layer
Sent Received
1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1
2. Burst Error: The term burst error means that two or more bits in the data unit have
changed from 0 to 1 or vice-versa. Note that burst error doesn’t necessary means that
error occurs in consecutive bits.
● Frame contains more than 1 consecutive bits corrupted.
Sent Received
1 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1
0 0 1 0 1 0 1 0 Hamming distance = 3
4.5
Computer Networks (BCA Science - III) Data Link Layer
● For example, if the codeword 00000 is sent and 01101 is received, the Hamming
distance between the two is d(00000, 01101) = 3 because 00000 ⊕ 01101 is 01101 (three
1’s)
● The Hamming distance d(10101, 11110) is 3 because 10101 ⊕ 11110 is 01011
Minimum Hamming Distance:
● The minimum Hamming distance is the smallest Hamming distance between all
possible pairs. To find this value, we find the Hamming distances between all words
and select the smallest one.
● To detect d errors, you need a distance (d+1) code because with such a code there is no
way that d-single bit errors can change a valid codeword into another valid codeword.
Whenever receiver sees an invalid codeword, it can tell that a transmission error has
occurred.
● Similarly, to correct d errors, you need a distance 2d+1 code because that way the legal
codewords are so far apart that even with d changes, the original codeword is still
closer than any other codeword, so it can be uniquely determined.
4.3.2 CRC (S-19,18)
● The most popular error detection technique is based on polynomial is called as CRC
(Cyclic Redundancy Check).
● In general, in this method, The transmitter generates an n-bit check sequence number
from a given k-bit frame such that the resulting (k+n) bit frame is divisible by some
number. The receiver divides the incoming frame by the same number. If the result of
the division does not leave a remainder, the receiver assumes that there was no error.
● CRC is used by all advanced data link protocols, for the following reasons:
1. Powerful error detection capability.
2. CRC can be efficiently implemented in hardware.
● In CRC , bit strings are represented as polynomials with the coefficients of 0 and 1
k–1
only. A k-bit frame is a coefficient list for a polynomial with k terms, ranging from x
0
to x . Such a polynomial is said to be of degree k-1.
● For example, 110001 has 6-bits so it will be represented as six term polynomial with
5 4 0
the coefficients 1, 1, 0, 0, 0 and 1.So polynomial is x + x + x .
● Polynomial arithmetic is done modulo 2 according to the algebra theory. It does not
have carries for addition or borrows for subtraction. Both addition and subtraction
are identical to exclusive OR.
● When this technique is used, sender and receiver must agree upon a generator
polynomial, G(x). High and low order bits must be 1. The checksum is appended in
such a way that polynomial represented by the checksummed frame is divisible by
G(x).
● When the receiver gets this frame, it divides it by G(x). If there is a remainder then
there is a transmission error.
4.6
Computer Networks (BCA Science - III) Data Link Layer
● To compute the CRC for some frame with m bits corresponding to the polynomial M(x),
the algorithm for computing the CRC is as follows:
1. Let r be the degree of G(x). Append r zero bits to the low-order end of the frame so
r
it now contains m + r bits and corresponds to the polynomial x M(x).
r
2. Divide the bit string corresponding to G(x) into the bit string corresponding to x
M(x), using modulo 2 division.
3. Subtract the remainder (which is always r or fewer bits) from the bit string
r
corresponding to x M(x) using modulo 2 subtraction. The result is the
checksummed frame to be transmitted. Call its polynomial T(x).
● The Fig. 4.7 shows basic scheme of CRC.
Sender Receiver
m n m n
Data 00...0 Data CRC
n bits n bits
CRC Reminder
N Y
Reject Zero Accept
Data CRC
● To understand this, we will study the following example. Suppose the message is
1101011011 and
G (x) = x4 + x + 1
∴ Generator = 10011
The message after 4-bits appended is r = 4.
11010110110000
Now this stream is divided by the generator.
xr M(x) = 11010110110000
Remainder = – 1110
T(x) = 11010110111110
Thus the transmitted frame is 11010110111110.
● Actual data bits plus the remainder is called a codeword. The sender transmits data
bits as codewords. At the other end, the receiver performs division operation on
codewords using the same CRC divisor. If the remainder contains all zeros the data
bits are accepted, otherwise it is considered as there is some data corruption occurred
in transit.
4.7
Computer Networks (BCA Science - III) Data Link Layer
1 1 0 0 0 0 1 0 1 0
100 11 1 1 0 1 0 1 1 0 1 1 0 0 0 0
1 0 0 1 1
1 0 0 1 1
1 0 0 1 1
0 0 0 0 1
0 0 0 0 0
0 0 0 1 0
0 0 0 0 0
0 0 0 0
0 0 0 0 0
0 1 0 1 0
0 0 0 0 0
1 0 1 1 0
1 0 0 1 0
0 1 0 1 0
0 0 0 0 0
1 0 1 0 0
1 0 0 1 1
0 1 1 1 0
0 0 0 0 0 Remeinder
1 1 1 0
Fig. 4.8: Calculation of CRC
Points to note in CRC:
1. The only relationship between the size of the codeword and dataword is the one
based on the definition: n = k + r, where n is the size of the codeword, k is the size
of the dataword, and r is the size of the remainder.
2. The remainder is always one bit smaller than the divisor.
3. The degree of the generator polynomial is one less than the size of the divisor. For
example, the CRC-32 generator (with the polynomial of degree 32) uses a 33-bit
divisor.
4. The degree of the generator polynomial is the same as the size of the remainder
(length of checkbits). For example, CRC-32 (with the polynomial of degree 32)
creates a remainder of 32 bits.
● A polynomial is selected to have at least the following properties:
o It should not be divisible by X.
o It should not be divisible by (X+1).
● The first condition guarantees that all burst errors of a length equal to the degree of
polynomial are detected. The second condition guarantees that all burst errors
affecting an odd number of bits are detected.
4.8
Computer Networks (BCA Science - III) Data Link Layer
0 0 1 1 1 0 0 1 1 1
0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 0 1 1 1
1 0 0 0 0 1 0 0 0 0
Sender Receiver
1 0 1 1 1 1 0 1 1 1
0 1 1 1 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 1 1 1 0 0
1 0 1 1 1 1 0 1 1 1
1 0 1 1 0 1 0 1 1 1
1 0 1 1 1 1 0 1 1 1
Remainder 0 0 0 1 Remainder (No error) 0 0 0 0
Codeword 1 0 1 0 0 1 1 1 0 0 0 1 Dataword 1 0 1 0 0 1 1 1
Fig. 4.9
4.9
Computer Networks (BCA Science - III) Data Link Layer
● For reliable and efficient data communication a great deal of coordination is necessary
between at least two machines. Some of the following constraints should be
considered:
o Both sender and receiver have limited speed.
o Both sender and receiver have limited memory.
It is necessary to satisfy the following requirements:
o A fast sender should not overwhelm a slow receiver, which must perform a certain
amount of processing before passing the data on to the higher level software.
o If error occur during transmission, it is necessary to devise mechanism to correct
it.
● The most important functions of Data Link layer to satisfy the above requirements are
error control and flow control. Collectively, these functions are known as data link
control.
● Flow Control is a technique so that transmitter and receiver with different speed
characteristics can communicate with each other. 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 should not be allowed to
overwhelm the receiver. Receiver should also be able to inform the transmitter before
its limits (this limit may be amount of memory used to store the incoming data or the
processing power at the receiver end) are reached and the sender must send fewer
frames.
● Hence, Flow control refers to the set of procedures used to restrict the amount of data
the transmitter can send before waiting for acknowledgment. It ensures that a
transmitting station, such as a server with higher processing capability, does not
overwhelm a receiving station, such as a desktop system, with lesser processing
capability. This is where there is an orderly flow of transmitted data between the
source and the destination.
● Error Control involves both error detection and error correction. It is necessary
because errors are inevitable in data communication, in spite of the use of better
equipment and reliable transmission media based on the current technology. In the
preceding section, we have already discussed how errors can be detected. When an
error is detected, the receiver can have the specified frame retransmitted by the
sender. This process is commonly known as Automatic Repeat Request (ARQ).
● Data link layer protocols combine framing, flow control, and error control to achieve
the delivery of data from one node to another. By using any common programming
language protocols are implemented. These protocols are divided into two types i.e.,
for noiseless channel, and for noisy channel as shown in Fig. 4.10.
● There are two methods developed for flow control namely Stop-and-wait and Sliding-
window.
4.11
Computer Networks (BCA Science - III) Data Link Layer
4.12
Computer Networks (BCA Science - III) Data Link Layer
Sender Receiver
Deliver
Network Get data Network
data
Request from
network layer Event
Repeat forever
Repeat forever
Algorithm for receiver site
Algorithm for sender site
Notification from
physical layer Event
Fig. 4.11: The design of the simplest protocol with no flow or error control
● If the protocol is implemented as a procedure, There is need to introduce the idea of
events in the protocol. The procedure at the sender site is constantly running; there is
no action until there is a request from the network layer. The procedure at the
receiver site is also constantly running, but there is no action until notification from
the physical layer arrives.
4.4.2 Stop-and-Wait Protocol
● Flow control deals with problem that sender transmits frames faster than receiver can
accept, and solution is to limit sender into sending no faster than receiver can handle.
● In this protocol, assumptions are as follows:
o Data are transmitted in one direction only.
o No errors occur (perfect channel).
o The receiver can only process the received information at a finite rate.
o These assumptions imply that the transmitter cannot send frames at a rate faster
than the receiver can process them.
Working:
● This is the simplest form of flow control where a sender transmits a data frame.
● After receiving the frame, the receiver indicates its willingness to accept another
frame by sending back an ACK frame acknowledging the frame just received.
● The sender must wait until it receives the ACK frame before sending the next data
frame. This is sometimes referred to as ping-pong behavior, request/reply is simple to
understand and easy to implement, but not very efficient.
4.13
Computer Networks (BCA Science - III) Data Link Layer
● In LAN environment with fast links, this isn't much of a concern, but WAN links will
spend most of their time idle, especially if several hops are required.
Design:
● The following Fig 4.12 shows the design of stop-and-wait protocol.
Sender Receiver
Deliver
Network Get data data Network
ACK frame
Request from
Event
network layer
Sender Receiver
Request Frame
Arrival
ACK
Arrival
Request Frame
Arrival
ACK
Arrival
Time Time
Fig. 4.13: Communication using Stop-and-Wait Protocol
4.14
Computer Networks (BCA Science - III) Data Link Layer
Go-back-n Selective-repeat
4.16
Computer Networks (BCA Science - III) Data Link Layer
Sender Receiver
Deliver
Network Get data Data frame ACK frame data Network
seqNo ackNo
Data link Data link
Algorithm for sender site Time out Algorithm for receiver site
Event
4.17
Computer Networks (BCA Science - III) Data Link Layer
Sender Receiver
Sn
Start Request 0 1 0 1 0 1 Rn
Frame 0
Sn 0 1 0 1 0 1 Arrival
ACK 1
Stop Arrival 0 1 0 1 0 1
Sn
Lost
Sn
Time-out Rn
Time-out 0 1 0 1 0 1 Frame 1 (r
restart e sent)
Sn 0 1 0 1 0 1 Arrival
ACK 0
Stop Arrival 0 1 0 1 0 1
Start Request 0 1 0 1 0 1 Rn
Frame 0
Sn 0 1 0 1 0 1 Arrival
ACK 1
Sn Lost
Time-out Rn
Time-out 0 1 0 1 0 1 Frame 0 (r
restart e sent)
Sn 0 1 0 1 0 1 Arrival
ACK 1 Discard, duplicate
Stop Arrival 0 1 0 1 0 1
Time Time
4.18
Computer Networks (BCA Science - III) Data Link Layer
Difference between Stop and wait protocol & stop and wait ARQ:
Sr. No. Stop and Wait protocol Stop and Wait ARQ
1. It assumes that the communication It assumes that the communication
channel is perfect and noise free. channel is imperfect and noisy.
2. Data packet sent by the sender can Data packet sent by the sender may get
never get corrupt. corrupt.
3. There is no concept of negative A negative acknowledgement is sent by
acknowledgements. the receiver if the data packet is found to
be corrupt.
4. There is no concept of time out Sender starts the time out timer after
timer. sending the data packet.
5. There is no concept of sequence Data packets and acknowledgements are
numbers. numbered using sequence numbers.
4.19
Computer Networks (BCA Science - III) Data Link Layer
2. A link control protocol for bringing lines up, testing them, negotiating options, and
bringing them down again gracefully when they are no longer needed. This protocol is
called LCP (Link Control Protocol). It supports synchronous and asynchronous circuits
and byte oriented and bit oriented encodings.
3. A way to negotiate network layer options in a way that is independent of the network
layer protocol to be used. The method chosen is to have a different NCP (Network
Control Protocol) for each network layer supported. The IP Control Protocol (IPCP)
negotiates IP address assignments and other parameters when IP is used as network
layer.
4. Authentication: It supports authentication. PPP supports two authentication protocols:
Password Authentication Protocol (PAP) and Challenge Handshake Authentication
Protocol (CHAP).
PPP Frame:
● PPP is a byte oriented protocol where each field of the frame is composed of one or
more bytes. The fields of a PPP frame are −
o Flag: 1 byte that marks the beginning and the end of the frame. The bit pattern of
the flag is 01111110.
o Address: 1 byte which is set to 11111111 in case of broadcast.
o Control: 1 byte set to a constant value of 11000000.
o Protocol: 1 or 2 bytes that define the type of data contained in the payload field.
o Payload: This carries the data from the network layer. The maximum length of the
payload field is 1500 bytes. However, this may be negotiated between the
endpoints of communication.
o FCS: It is a 2 byte or 4 bytes frame check sequence for error detection. The
standard code used is CRC (Cyclic Redundancy Code)
PPP Frame
4.20
Computer Networks (BCA Science - III) Data Link Layer
4.21
Computer Networks (BCA Science - III) Data Link Layer
Flag Address Control User data from upper layers FCS Flag
S - Frame
U - Frame
4.22
Computer Networks (BCA Science - III) Data Link Layer
Sender Receiver
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
ACK 2 Received
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
Frame 2 sent
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
ACK 3 Received
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
● The sequence numbers are numbered as modulo-n means that they are numbered
from 0 to n-1. For example, if the sending window size is 4, then the sequence
numbers will be 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, and so on. The number of bits in the sequence
number is 2 to generate the binary sequence 00, 01, 10, 11.
● The size of the receiving window is the maximum number of frames that the receiver
can accept at a time. It determines the maximum number of frames that the sender
can send before receiving acknowledgment.
● For example, Suppose that we have sender window and receiver window each of size
4. So the sequence numbering of both the windows will be 0,1,2,3,0,1,2 and so on. The
following figure shows the positions of the windows after sending the frames and
receiving acknowledgments.
● 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.
Sender Window
● At the beginning of a transmission, the sender window contains n-1 frames, and when
they are sent out, the left boundary moves inward shrinking the size of the window.
For example, if the size of the window is w if three frames are sent out, then the
number of frames left out in the sender window is w-3.
● Once the ACK has arrived, then the sender window expands to the number which will
be equal to the number of frames acknowledged by ACK.
● For example, the size of the window is 7, and if frames 0 through 4 have been sent out
and no acknowledgement has arrived, then the sender window contains only two
frames, i.e., 5 and 6. Now, if ACK has arrived with a number 4 which means that 0
through 3 frames have arrived undamaged and the sender window is expanded to
include the next four frames. Therefore, the sender window contains six frames
(5,6,7,0,1,2).
Sender window
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
Direction Direction
This wall moves to the right This wall moves to the right
when a frame is sent when an ACK is received
4.24
Computer Networks (BCA Science - III) Data Link Layer
● When the new frame arrives, the size of the window shrinks.
● The receiver window does not represent the number of frames received, but it
represents the number of frames that can be received before an ACK is sent. For
example, the size of the window is w, if three frames are received then the number of
spaces available in the window is (w-3).
● Once the acknowledgement is sent, the receiver window expands by the number equal
to the number of frames acknowledged.
● Suppose the size of the window is 7 means that the receiver window contains seven
spaces for seven frames. If the one frame is received, then the receiver window
shrinks and moving the boundary from 0 to 1. In this way, window shrinks one by
one, so window now contains the six spaces. If frames from 0 through 4 have sent,
then the window contains two spaces before an acknowledgement is sent.
Receiver window
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
Direction Direction
This wall moves to the right This wall moves to the right
when a frame is received when an ACK is sent
4.25
Computer Networks (BCA Science - III) Data Link Layer
6. When the first valid frame arrives at computer B, it will be accepted. All other frames
will be rejected because, B is expecting a frame with sequence number 1 and not 0.
Now B is waiting for an acknowledgment of 0 and will not send any more frames.
7. This situation arises if both sides simultaneously send an initial packet. Here,
duplicate frames are delivered even though there is no transmission error.
8. Diagrammatically, it can be represented as follows:
o Show normal operation.
o A and B starts simultaneously, so there are duplicates. The format is (sequential
acknowledgment, packet number). An asterisk indicates where a network layer
accepts a packet.
4.26
Computer Networks (BCA Science - III) Data Link Layer
Time Time
Fig. 4.24: Shows three principles of governing piggybacking
4.27
Computer Networks (BCA Science - III) Data Link Layer
Advantages of Piggybacking:
1. A better use of available channel bandwidth.
2. The acknowledgment field is only a few bits whereas the entire acknowledgment
frame would consist of many bits because of header, checksum etc.
3. Fewer frames sent means fewer received reducing the traffic and requires fewer
buffers in the receiver.
Disadvantages of Piggybacking:
1. The main problem with piggybacking is how long the sender should wait for a
packet onto which the acknowledgment is sent. If it waits longer than the senders
timeout, the frame will be retransmitted.
2. Actually piggybacking is used for better channel utilization, here due to
retransmission bandwidth is wasted.
4.5.3 Pipelining – Go-Back-N and Selective Repeat
● Pipelining is a process of sending multiple data frames serially without waiting for the
previous acknowledgement.
● This technique is beneficial when the amount of data to be transferred is very large,
and we send the data by dividing them into various parts.
● These data parts can be pipelined and sent to the receiver over the channel. In
pipelining, we do not wait for the acknowledgement of sent data frames. We keep on
sending the data frames continuously without bothering about the acknowledgements.
● Hence, pipelining ensures the efficient and better utilization of network resources. It
also enhances the speed of delivery of data frames, ensuring the timely transmission
of data.
● Two basic approaches are available for dealing with errors in the presence of
pipelining i.e. Go-Back-N, and Selective Repeat
1. Go-Back-N ARQ:
● Go-Back-N ARQ makes efficient use of a connection than Stop-and-wait ARQ. Go – Back
– N ARQ provides for sending multiple frames before receiving the acknowledgment
for the first frame.
● In this protocol, 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.
4.28
Computer Networks (BCA Science - III) Data Link Layer
● Unlike waiting for an acknowledgement for each packet in stop-and-wait ARQ, the
connection is still being utilized as packets are being sent. In other words, during the
time that would otherwise be spent waiting, more packets are being sent.
● It is a special case of the general sliding window protocol with the transmit window
size of N and receive window size of 1. It can transmit N frames to the peer before
requiring an ACK.
● The receiver process keeps track of the sequence number of the next frame it expects
to receive, and sends that number with every ACK it sends.
● The receiver will discard any frame that does not have the exact sequence number it
expects (either a duplicate frame it already acknowledged, or an out-of-order frame it
expects to receive later) and will resend an ACK for the last correct in-order frame.
● Once the sender has sent all of the frames in its window, it will detect that all of the
frames since the first lost frame are outstanding, and will go back to the sequence
number of the last ACK it received from the receiver process and fill its window
starting with that frame and continue the process over again.
● Consider the figure given below. Suppose sender window size of 4. Now the sender
has sent the packets 0, 1, 2 and 3. After acknowledging the packets 0 and 1, receiver is
now expecting packet 2 and sender window has also slided to further transmit the
packets 4 and 5.
● Now suppose the packet 2 is lost in the network, Receiver will discard all the packets
which sender has transmitted after packet 2 as it is expecting sequence number of 2.
On the sender side for every packet send there is a time out timer which will expire
for packet number 2.
● Now from the last transmitted packet number 5 sender will go back to the packet
number 2 in the current window and transmit all the packets till packet number 5.
That’s why it is called Go Back N. Go back means sender has to go back N places from
the last transmitted packet in the unacknowledged window and not from the point
where the packet is lost.
Packet 2 is lost in network 0 1 2
0 1
0
1
2
3
5 4 3 2 1 0
Lost
(Discarded as 2 is expected)
Time out 4
Timer 5
Go Back 4
2 Discarded
3 Discarded
4 Window
5 Transmitted
again
Fig. 4.26: Working of Go-Back-N protocol
4.29
Computer Networks (BCA Science - III) Data Link Layer
Receiver
Sender
Deliver
Network Get data Data frame ACK frame data Network
SeqNo ackNo
Data link Data link
Request from
Event
network layer
Algorithm for sender site Time out Algorithm for receiver site
Event
4.30
Computer Networks (BCA Science - III) Data Link Layer
Sf Sn Sf Sn
Fram Fram
I 0 1 2 3 e 0 I 0 1 2 3 0 e 0
0123 0 12 30
Sf Sn Sf Sn
Rn Rn
Fram Fram
0 1 2 3 e 1 0 1 2 3 0 e 1
01 2 3 01 2 30
Sf Sn Rn Sf Sn Rn
Fram Fram
0 1 2 3 e 2 0 1 2 3 0 e 2
01 23 01 230
Sf Sn Rn Sf Sn Rn
Fram Fram
0 1 2 3 e0 0 1 2 3 0 e3
Time out 0123 01 2 30
Rn Rn
Fram
Time out e0
Correctly 01230
discards
Rn
m m
(a) window size < 2 (b) Window size = 2
m m
Fig. 4.28: Comparison between window size < 2 and Window size = 2
Advantages of Go-Back N :
1. The sender can send many frames at a time.
2. Timer can be set for a group of frames.
3. Only one ACK can acknowledge one or more frames.
4. Efficiency is more.
5. Waiting time is low.
6. We can alter the size of the sender window.
Disadvantages of Go-Back N:
1. Buffer requirement is more.
2. Transmitter needs to store the last N packets.
3. Scheme is inefficient when round-trip delay large and data transmission rate is
high
4. If NACK is lost , a long time is wasted until re-transmission of all packets (until
another NACK is sent).
2. Selective Repeat ARQ:
● In Go-Back N method results in sending frames multiple times – if any frame was lost
or damaged, or the ACK acknowledging them was lost or damaged, then that frame
4.31
Computer Networks (BCA Science - III) Data Link Layer
and all following frames in the send window (even if they were received without
error) will be re-sent. To avoid this, Selective Repeat ARQ can be used.
● Selective Repeat ARQ protocol supports sending of multiple frames before receiving
the acknowledgment for the first frame. However, here only the erroneous or lost
frames are retransmitted, while the good frames are received and buffered.
Working:
● The Selective Repeat Protocol also uses two windows: a send window and a receive
window.
● Sender window size is always same as receiver window size.
● If n bits are available for sequence numbers, then- Sender window size = Receiver
n n-1
window size = 2 /2 = 2 . This is to avoid packets being recognized incorrectly. If the
windows size is greater than half the sequence number space, then if an ACK is lost,
the sender may send new packets that the receiver believes are retransmissions.
● Selective Repeat protocol provides for sending multiple frames depending upon the
availability of frames in the sending window, even if it does not receive
acknowledgement for any frame in the interim. The maximum number of frames that
can be sent depends upon the size of the sending window.
● Receiver acknowledges each frame independently. As receiver receives a new frame
from the sender, it sends its acknowledgement.
● The receiver records the sequence number of the earliest incorrect or un-received
frame. It then fills the receiving window with the subsequent frames that it has
received. It sends the sequence number of the missing frame along with every
acknowledgement frame.
● The sender continues to send frames that are in its sending window. Once, it has sent
all the frames in the window, it retransmits the frame whose sequence number is
given by the acknowledgements. It then continues sending the other frames.
● If receiver receives a frame that is corrupted, then it does not silently discard that
frame. Receiver handles the situation efficiently by sending a negative
acknowledgement (NACK). Negative acknowledgement allows early retransmission of
the corrupted frame. It also avoids waiting for the time out timer to expire at the
sender side to retransmit the frame.
● If receiver receives a frame whose sequence number is not what the receiver expects,
then it does not discard that frame rather accepts it and keeps it in its window.
Design:
● The design in this case is to some extent similar to the Go Back-N, but more
complicated, as shown in the following figure.
4.32
Computer Networks (BCA Science - III) Data Link Layer
Sender Receiver
Deliver
Network Get data Data frame ACK or NAK data Network
SeqNo ackNo
Data link or Data link
nakNo
Request from
Event
network layer
Algorithm for sender site Time out Algorithm for receiver site
Event
4.33
Computer Networks (BCA Science - III) Data Link Layer
Multiple - access
Protocols
Polling TDMA
CSMA/CA
4.35
Computer Networks (BCA Science - III) Data Link Layer
4.6.1 ALOHA
● ALOHA is a system for coordinating and arbitrating access to a shared communication
Networks channel.
● ALOHA was developed in the 1970s by Norman Abramson and his colleagues at the
University of Hawaii to solve the problem of channel allocation.
● ALOHA was designed for a wireless LAN, but it can be used on any shared medium.
● The medium is shared between the stations. When a station sends data , another
station may attempt to send data same time. It is obvious that the data from the two
stations collide and destroyed.
● There are two types of ALOHA protocols i.e., Pure ALOHA and Slotted ALOHA as
discussed in following sections.
4.6.1.1 Pure ALOHA (W-18)
● If the frame is destroyed because of collision the station waits for a random amount of
time and sends it again. This waiting time must be random otherwise same frames will
collide again and again.
● Therefore pure ALOHA dictates that when time-out period passes, each station must
wait for a random amount of time before resending its frame. This randomness will
help avoid more collisions.
4.37
Computer Networks (BCA Science - III) Data Link Layer
● A node or station sends the frame. Then wait for a period of time which is 2 times the
maximum propagation delay.
● If the acknowledgement is received, the transmission is successful. If the
acknowledgement is not given then station has to use a backoff strategy and send the
packet again. After several tries, if it is not happen then procedure is aborted.
● Vulnerable Time: Vulnerable time is a time in which there is possibility of collision. It
is calculated as,
Pure ALOHA vulnerable time = 2 × T fr
● Throughput: Let G be the average number of frames generated by the system during
one frame transmission time. Then average number of successful transmission for
-2G.
pure ALOHA is S = G × e The maximum throughput of pure ALOHA is 0.184 i.e. not
more than 18.4 %.
Example 3: A pure ALOHA network transmits 200-bit frames on a shared channel of
200 kbps. What is the throughput if the system (all stations together) produces:
(a) 1000 frames per second, (b) 500 frames per second and (c) 250 frames per second.
Solution:
The frame transmission time is 200/200 kbps or 1 ms.
(a) If the system creates 1000 frames per second, this is 1 frame per millisecond. The
-2G
load is 1. In this case S = G × e or S = 0.135 (13.5 percent). This means that the
throughput is 1000 × 0.135 = 135 frames. Only 135 frames out of 1000 will probably
survive.
(b) If the system creates 500 frames per second, this is (1/2) frame per millisecond. The
–2G
load is (112). In this case S =G x e or S = 0.184 (18.4 percent). This means that the
throughput is 500 × 0. 184 = 92 and that only 92 frames out of 500 will probably
survive. Note that this is the maximum throughput case, percentagewise.
(c) If the system creates 250 frames per second, this is (1/4) frame per millisecond. The
–2G
load is (1/4). In this case S = G × e or S = 0.152 (15.2 percent). This means that the
throughput is 250 × 0.152 = 38. Only 38 frames out of 250 will probably survive.
4.38
Computer Networks (BCA Science - III) Data Link Layer
● In slotted ALOHA, there is still a possibility of collision if two stations try to send at the
beginning of the same time slot as shown in Fig. 4.34.
● Slotted ALOHA still has an edge over pure ALOHA as chances of collision are reduced
to one-half. Slotted ALOHA requires global time synchronization.
● Vulnerable Time: It reduces the vulnerable period from 2T to T frames and improves
efficiency by reducing the probability of collision.
Slotted ALOHA vulnerable time = T fr
4.39
Computer Networks (BCA Science - III) Data Link Layer
● Throughput:
-G
Slotted ALOHA is S = G × e .
● The maximum throughput of slotted ALOHA is 0.37 i.e. not more than 37 %.
Example 4: A slotted ALOHA network transmists 200-bit frames using a shared
channel with a 200-kbps bandwidth. Find the throughput if the system (all stations
together) produces:
(a) 1000 frames per second,
(b) 500 frames per second, and
(c) 250 frames per second.
Solution: This solution is similar to the previous example except that the network is
using slotted ALOHA instead of pure ALOHA. The frame transmission time is 200/200 kpbs
or 1 ms.
–G
(a) In this case G is 1. So S = G × e or S = 0.368 (36.8 percent). This means that the
throughput is 1000 × 0.0368 = 368 frames. Only 368 out of 1000 frames will
probably survive. Note that this is the maximum throughput case,
percentagewise.
–G
(b) Here G is 1/2. In this case S = G × e or S = 0.303 (30.3 per cent). This means
that the throughput is 500 × 0.0303 = 151. Only 151 frames out of 500 will
probably survive.
–G
(c) Now G is 1/4. In this case S = G × e or S = 0.195 (19.5 percent). This means that the
throughtput is 250 × 0.195 = 49. Only 49 frames out of 250 will probably
survive.
4.6.2 CSMA
● The poor efficiency of the ALOHA scheme can be attributed to the fact that a node start
transmission without paying any attention to what others are doing.
● In situations where propagation delay of the signal between two nodes is small
compared to the transmission time of a packet, all other nodes will know very quickly
when a node starts transmission. This observation is the basis of the Carrier Sense
Multiple Access (CSMA) protocol.
● In this scheme, a node having data to transmit first listens to the medium to check
whether another transmission is in progress or not. The node starts sending only
when the channel is free, that is there is no carrier. That is why the scheme is also
known as listen-before talk.
● CSMA is a network access method used on shared network topologies such as Ethernet
to control access to the network.
● Devices attached to the network cable listen (carrier sense) before transmitting. If the
channel is in use, devices wait before transmitting. MA (Multiple Access) indicates that
4.40
Computer Networks (BCA Science - III) Data Link Layer
many devices can connect to and share the same network. All devices have equal
access to use the network when it is clear.
● Even though devices attempt to sense whether the network is in use, there is a good
chance that two stations will attempt to access it at the same time. On large networks,
the transmission time between one end of the cable and another is enough that one
station may access the cable even though another has already just accessed it.
● The chances of collision still exist because of propagation delay. The frame transmitted
by one station takes some time to reach other stations. In the meantime, other stations
may sense the channel to be idle and transmit their frames. This results in the
collision, as shown in Fig. 4.36.
● In CSMA, Carrier Sense (CS) means that whenever a device wants to send a packet over
the network media, it first listens to the network media to see whether anyone else is
already sending a packet. Multiple Access (MA) means that nothing prevents two or
more devices from trying to send a message at the same time. Sure, each device listens
before sending.
Vulnerable Time:
● The vulnerable time for CSMA is the propagation time Tp1, needed for a signal to
propagate from one end of the medium to the other. When a station sends a frame,
and any other station tries to send, collision occurs. But if the first bit of the frame
reaches the end of the medium, other stations will already have heard the bit and will
stop ourselves from sending.
4.41
Computer Networks (BCA Science - III) Data Link Layer
4.42
Computer Networks (BCA Science - III) Data Link Layer
● If the station 1 signal has not yet reached station 2, station 2 will sense the channel to
be idle and will begin its transmission. This will result in collision.
Sense and Transmit
Continuously sense
Channel ?
Time Busy
Idle
idle channel
Busy channel Station can transmit
Busy Wait
Channel ? Randomely
Idle
Time
Idle channel
Busy channel
Fig. 4.40: Non-persistent CSMA
● In non-persistent CSMA, the station does not continuously sense the channel for the
purpose of capturing it when it detects the end of previous transmission.
Advantage of Non-persistent CSMA: (S-18)
1. It reduces the chance of collision because the stations wait a random amount of
time.
2. It is unlikely that two or more stations will wait for same amount of time and will
retransmit at the same time.
4.43
Computer Networks (BCA Science - III) Data Link Layer
Time
Channel ?
Busy
Idle
Idle
>p Probability
Channel ? Wait a slot
outcome
Busy <=P
4.44
Computer Networks (BCA Science - III) Data Link Layer
● CSMA/CD stands for Carrier Sense Multiple Access with Collision Detection. Collision
detection means that after a device sends a packet, it listens carefully to see whether
the packet crashes into another packet.
● CSMA/CD protocol can be considered as a refinement over the CSMA scheme. It has
evolved to overcome one glaring inefficiency of CSMA. In CSMA scheme, when two
packets collide the channel remains unutilized for the entire duration of transmission
time of both the packets. If the propagation time is small (which is usually the case)
compared to the packet transmission time, wasted channel capacity can be
considerable.
● This wastage of channel capacity can be reduced if the nodes continue to monitor the
channel while transmitting a packet and immediately stop transmission when
collision is detected. This refined scheme is known as CSMA/CD or Listen-While-Talk.
● On top of the CSMA, the following rules are added to convert it into CSMA/CD:
1. If a collision is detected during transmission of a packet, the node immediately
stops transmission and it transmits jamming signal for a brief duration to ensure
that all stations know that collision has occurred.
2. After transmitting the jamming signal, the node waits for a random amount of
time and then transmission is resumed.
● The random delay ensures that the nodes, which were involved in the collision, are
not likely to have a collision at the time of retransmissions. To achieve stability in the
back off scheme, a technique known as binary exponential back off is used. A node
will attempt to transmit repeatedly in the face of repeated collisions, but after each
collision, the mean value of the random delay is doubled.
● Therefore the CSMA/CD method consists of alternating transmission period and
collisions with idle periods when none of the stations is transmitting.
Collision
Idle period
Frame Frame
Time
Transmission Transmission
period period
Fig. 4.42: CSMA/CD with Three States
4.45
Computer Networks (BCA Science - III) Data Link Layer
● The entire scheme of CSMA/CD is described in the Fig. 4.43 and 4.44.
1 2 3 4
t1
First bit of 1
Transmission t2
Transmission
time
t3 time
fC
t4 First bit o 3’ s collision
1’ s collision detection
detection Collision and abortion
and abortion occurs
Time
Fig. 4.43: Collision of the First Bit in CSMA/CD
1 2 3 4
Collision
t1 occurs
Transmission t2 Transmission
time Part of 1’s frame t3 time
frame
t4 Part of 3’s
1 detects
collision and
aborts
3 detects
collision and
Time aborts Time
Fig. 4.44: Collision and Abortion in CSMA/CD
CSMA/CD Procedure:
● Fig. 4.45 shows a flow chart for the CSMA/CD protocol.
Explanation of Fig. 4.45:
● The station that has a ready frame sets the back off parameter to zero.
● Then it senses the line using one of the persistent strategies.
● It then sends the frame. If there is no collision for a period corresponding to one
complete frame, then the transmission is successful.
● Otherwise the station sends the jam signal to inform the other stations about the
collision.
● The station then increments the back off time and waits for a random back off time
and sends the frame again.
● If the back off has reached its limit then the station aborts the transmission.
● CSMA/CD is used for the traditional Ethernet.
● CSMA/CD is an important protocol. IEEE 802.3 (Ethernet) is an example of CSMNCD. It
is an international standard.
● The MAC sublayer protocol does not guarantee reliable delivery. Even in absence of
collision the receiver may not have copied the frame correctly.
4.46
Computer Networks (BCA Science - III) Data Link Layer
Transmission done
Wait TB time Yes
or
(TB =R X or R X Tfr) Collision detected
No
Choose a random
Transmit
number R between
K and Receive
0 and 2 - 1
No
Kmax is Send a Yes Collision
K > Kmax K=K+1
normally 15 jamming signal detected
Yes No
Abort Success
● When there is collision, the station receives two signals, its own and signals
transmitted by another station. Station needs to distinguish between these two signals.
● In wired networks if collision occurs detected energy is almost double whereas in
wireless networks much of the energy is lost in transmission only. So it becomes
difficult to detect collision.
● There is need to avoid collision in wireless networks , because they cannot be detected.
Carrier sense multiple access with collision avoidance (CSMA/CA) was invented for this
network.
● CSMA/CA avoids the collisions using three basic techniques as shown in the Fig. 4.46..
1. Inter frame space.
2. Contention window.
3. Acknowledgements.
Found idle Size:Binary
eponential
IFS
Time
Contention window
Busy Send frame Time out
Fig. 4.46: CSMA/CA with Three States
1. Inter-Frame Space (IFS):
● Whenever the channel is found idle, the station does not transmit immediately. It
waits for a period of time called Inter Frame 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.
4.48
Computer Networks (BCA Science - III) Data Link Layer
● If the station finds the channel busy, it does not restart the process. It just stops the
timer and 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. 4.47 shows the flow chart explaining the principle of CSMA/CA.
Explanation of Fig. 4.47:
● 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 finds 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.
Start
Persistent
strategy
Wait for a
random time
Wait for
back off time Send the frame
Set a timer
No
ACK
Back off Increment received before
limit? back off time out?
Yes Yes
Abort Success
4.49
Computer Networks (BCA Science - III) Data Link Layer
● 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.
Advantages of CSMA/CA:
1. CSMA/CA is effective and it avoids data collisions.
2. CSMA/CA is reliable. Intent signals are sent until the cable is clear so that data will
travel and reach its destination safely.
Disadvantages of CSMA/CA:
1. CSMA/CA is relatively slow. A signal of intent must be sent every time a computer
wants to transmit causing signal traffic.
2. CSMA/CA is not useful for large/active networks.
3. CSMA/CA suffers from same distance limitations as CSMA/CD since it must listen
for the signals of intent.
● Fig. 4.48 shows five stations. In the first, reservation frame stations 1, 3 and 4 have
made the reservations.
● So the reservation frame is first followed by data frames of station 1, 3 and 4. In the
second interval, only station 1 has made the reservation.
4.7.2 Polling (W-18)
● In this method, one station is designated as a primary station and others are secondary
stations.
● 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. The primary device, therefore, is always the initiator of a session. If the
primary station wants to receive data, it asks the secondary’s if they have anything to
send. This method is called as polling.
● If primary station wants to send data, it asks secondary station to receive the data.
This is called as selecting.
1. Select:
● This is used when primary device sends the data.
● When primary station wants to send data to other machines, it should intimate the
other secondary device that it is sending the data.
● To do this, the primary machine first sends the SEL frame in which the address of the
machine (secondary machine) to which it wants to send the data is present.
● Then, the primary machine waits for the acknowledgement from that machine. Once
the acknowledgement is reached then the data is send.
2. Poll:
● Whenever primary wants to receive data then polling is used. It polls each machine, if
it has something to send.
A B C A B C
Primary Primary
SEL Poll
ACK
NAK
Select
Data Poll
Poll
ACK
Data
ACK
● The secondary responds either with NAK frame which means nothing to send or with
data frame if it wants to send data. If the response from the secondary device is
negative i.e. received NAK frame then the next machine is polled until it finds one
with data to send.
● When the primary machine gets the data, it accepts the data frame and returns the
acknowledgement.
● Fig. 4.49 shows select and poll functions in polling access method.
4.7.3 Token Passing (W-18)
● In this method, a station is allowed to send data when the station receives a special
frame called token.
● In token passing, the stations are organized in the form of a logical ring. For every
station there is predecessor and a successor.
● Control of the access to the medium is performed using a token. A token is a special bit
pattern or a small packet, usually several bits in length, which circulate from node to
node.
● The right to access the channel has been passed from predecessor to the current
station. The right will be passed to the successor when the current station has no more
data to send.
● The possession of the token gives the station the right to access the channel and send
its data.
● Fig. 4.50 shows concepts of token passing.
4.52
Computer Networks (BCA Science - III) Data Link Layer
Wait for
the token
Capture
the token
No
Allocated time Yes Data frame
expired? Sent a frame to send?
Yes No
Release
the token
Stop
Channelization Protocols
4.54
Computer Networks (BCA Science - III) Data Link Layer
● FDM is a physical layer technique whereas FDMA is an access method in the data link
layer. The data link layer in each station tells its physical layer to make a band pass
signal from the data passed to it. The signal must be created in the allocated band.
● So FDMA is the process of dividing one channel or bandwidth into multiple individual
bands, each for use by a single user. Each individual band or channel is wide enough
to accommodate the signal spectra of the transmissions to be propagated. The data to
be transmitted is modulated on to each subcarrier, and all of them are linearly mixed
together.
● The best example of FDMA is the cable television system.
● Fig. 4.53 shows FDMA concept.
Data Data
f f
A B
t t
Common
Channel
Data
f f
C D
t t
Silent Data
Fig. 4.53: FDMA
Advantages of FDMA:
1. A continuous transmission scheme and therefore of lower complexity.
2. FDMA technology is mature and cost is low.
3. Simple to implement from a hardware stand-point, because multiple users are
isolated by employing simple band pass filters.
4. No channel equalization required in FDMA.
Disadvantages of FDMA:
1. Channel allocation is not flexible in FDMA.
2. In FDMA network and spectrum planning are intensive.
3. In FDMA frequency planning is time consuming.
4. FDMA requires unlink power control to maintain link quality.
4.55
Computer Networks (BCA Science - III) Data Link Layer
4.8.2 TDMA
● TDMA is a channel access method for stored medium networks.
● In time-division multiple access (TDMA) stations share the bandwidth of the channel
in time. Every station is allocated a time slot, in which it can send data.
● In TDMA, the bandwidth is just one channel that is timeshared between different
stations.
● The main problem with TDMA lies in achieving synchronization between the different
stations. Each station needs to know the beginning of its slot and the location of its
slot. This may be difficult because of propagation delays introduced in the system if
the stations are spread over a large area.
Data Data
f f
A B
t t
Common
Channel
Data
f f
C D
t t
Silent Data
Fig. 4.54: TDMA
● TDMA and TDM are seems to be conceptually same, but they are different. TDM is a
physical layer technique that combines the data from slower channels and transmits
them by using a faster channel. The process uses a physical multiplexer that
interleaves data units from each channel, whereas TDMA is Data link layer access
method. The Data link layer in each station tells its Physical layer to use the allocated
time slot.
● TDMA is used in digital mobile radio systems.
Advantages of TDMA:
1. TDMA is most efficient method of transmission because of efficient use of
transmission resources.
2. At a given time only one carrier is present on the channel hence intermodulation
distortion is eliminated.
4.56
Computer Networks (BCA Science - III) Data Link Layer
3. TDMA is more flexible than FDMA because of TDMA can accommodate a wider
range of bit rates by allowing a station to be allocated several slots.
4. TDMA transmission is separated in time domain. Processing of signal in time
domain is easier and simpler.
Disadvantages of TDMA:
1. Bit and frame timings must be maintained by TDMA.
2. Precise synchronization between stations is required. Transmission of every
station must occur during exact time slot.
4.8.3 CDMA
● CDMA (Code Division Multiple Access) also called spread-spectrum and code division
multiplexing, one of the competing transmission technologies for digital mobile
phones.
● In CDMA, Data from all stations are transmitted simultaneously and are separated
based on coding theory.
● In TDMA and FDMA the transmissions from different stations are clearly separated in
either time or frequency.
● In case of CDMA, the transmissions from different stations occupy the entire
frequency band at the same time.
● Multiple simultaneous transmissions are separated by using coding theory.
● Each bit is assigned a unique m-bit code or chip sequence.
Advantages of CDMA:
1. High immunity for interference and jamming.
2. CDMA does not require any time synchronization among the stations.
3. In CDMA each stations can use entire bandwidth at any time.
4. CDMA offers highly secured communication.
Disadvantages of CDMA:
1. Low throughput efficiency.
2. The overall performance degrades with increase in number of users.
Summary
The Data Link Layer is the second layer in the OSI model. The main functions of the
data link layer are providing the service interface to the network layer and Dealing
with the transmission errors.
The data link layer services differ from system to system. The three main services are
unacknowledged connectionless service, acknowledged connectionless service and
acknowledged connection oriented service.
4.57
Computer Networks (BCA Science - III) Data Link Layer
4.58
Computer Networks (BCA Science - III) Data Link Layer
In Polling method, one station is designated as a primary station and others are
secondary stations.
In Token Passing method, a station is allowed to send data when the station receives a
special frame called token.
In token passing, the stations are organized in the form of a logical ring. For every
station there is predecessor and a successor.
Channelization is the multiple access method in which the available bandwidth of a
link is shared in time, frequency or through code between different stations.
Channelization protocols are FDMA ( Frequency Division Multiple Access) here, the
bandwidth is shared by all stations, TDMA (Time Division Multiple Access) here, the
entire bandwidth is one channel. Each station is allocated a time slice. During its time
slice, the data is send and CDMA (Code Division Multiple Access) here, only one
channel occupies the entire bandwidth of the link. All stations can send data
simultaneously.
7. In _______ methods, the stations consult one another to find which station has the
right to send.
(a) Random access (b) Controlled access
(c) Channelization (d) None of the above.
8. In the _______ method, each station has a predecessor and a successor.
(a) Reservation (b) Polling
(c) Token passing (d) None of the above.
9. In ________, the available bandwidth is divided into frequency bands.
(a) FDMA (b) TDMA
(c) CDMA (d) None of the above.
10. In _______, the sequences are generated using orthogonal codes such the Walsh
tables.
(a) FDMA (b) TDMA
(c) CDMA (d) None of the above.
Practice Questions
Q.I: Answers the Following Questions in short.
1. What is channelization?
2. What are different framing methods?
3. What is meant by byte stuffing?
4. What is meant by CRC?
5. Which are the type of errors?
6. List out the random access protocols.
7. List out persistence methods.
Q.II: Answers the Following Questions.
1. Explain the concept of framing in detail in data link layer
2. Explain error detection at the data link layer.
3. The 10 bit sequence is 1010011110 and the divisor of 1011. Find the CRC.
4. Explain the pure aloha and slotted aloha.
5. Compare and contrast between controlled accesses over random access.
6. What is the difference between polling and selecting?
7. What is chip sequence?
8. Write short note on:
(i) 1-persistent CSMA,
(ii) Non-persistent CSMA.
4.60
Computer Networks (BCA Science - III) Data Link Layer
4.62