0% found this document useful (0 votes)
12 views11 pages

CN - Chapter-1 Part-2

Everything about Computer networks part2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views11 pages

CN - Chapter-1 Part-2

Everything about Computer networks part2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Computer Networks (20EC C27)

Chapter-1, Part-2

1. Data Link Layer Design Issues

The Data Link Layer is the second layer from the bottom of the OSI (Open Systems
Interconnection) model, and it plays a crucial role in ensuring reliable data communication
between devices on a local network. There are several design issues and considerations that
need to be addressed when designing the Data Link Layer:

1. Framing: One of the primary functions of the Data Link Layer is to break data into
frames for transmission and reassemble received frames into data. Design decisions
need to be made about how frames are delimited, how they are identified, and how
errors are detected and corrected.

2. Physical Addressing: Devices on a local network need unique addresses to identify


each other. The Data Link Layer designs must include addressing schemes, such as
MAC (Media Access Control) addresses for Ethernet networks, to ensure proper
destination addressing.
3. Flow Control: To prevent congestion and data loss, the Data Link Layer must
implement flow control mechanisms. This can be achieved using techniques like
sliding window protocols to manage the flow of data between sender and receiver.

4. Error Detection and Correction: The Data Link Layer is responsible for detecting
and correcting errors that may occur during transmission. Designers must choose
appropriate error-detection mechanisms (e.g., CRC) and error-correction techniques
(e.g., Hamming codes) based on the network's requirements.

5. Media Access Control: In shared media networks, multiple devices contend for
access to the transmission medium. Designing efficient media access control
protocols (e.g., CSMA/CD for Ethernet and CSAM/CA for Wi-Fi) is critical to avoid
collisions and ensure fair access.

Addressing these design issues appropriately is crucial for the efficient and reliable operation
of the Data Link Layer in computer networks. The specific choices made will depend on the
network's requirements, technologies used, and performance expectations.

2. Framing:

In the physical layer, data transmission involves synchronised transmission of bits from the
source to the destination. The data link layer packs these bits into frames.

Data-link layer takes the packets from the Network Layer and encapsulates them into frames.
If the frame size becomes too large, then the packet may be divided into small sized frames.
Smaller sized frames make flow control and error control more efficient.
Then, it sends each frame bit-by-bit on the hardware. At receiver's end, data link layer picks
up signals from hardware and assembles them into frames.

Types of Framing

Framing can be of two types, fixed sized framing and variable sized framing.

Fixed-sized Framing: Here the size of the frame is fixed and so the frame length acts as
delimiter of the frame. Consequently, it does not require additional boundary bits to identify
the start and end of the frame

Variable – Sized Framing: Here, the size of each frame to be transmitted may be different.
So additional mechanisms are required to mark the end of one frame and the beginning of the
next frame.

3. Elementary Data Link Protocols:

Elementary data link protocols are basic communication protocols that operate at the Data
Link Layer (Layer 2 bottom to top) of the OSI model. These protocols are often used as
building blocks for more complex data link protocols and are essential for enabling reliable
and error-free communication over a network.

3.1. Flow control for lossless medium

Here are two common elementary data link protocols for flow control for reliable data
transfer:

3.1.1. Stop-and-Wait Protocol:

The simplest form of flow control, known as stop-and-wait flow control, works as follows.

A source entity transmits a frame. After the destination entity receives the frame, it indicates
its willingness to accept another frame by sending back an acknowledgment to the frame just
received. The source must wait until it receives the acknowledgment before sending the next
frame. The destination can thus stop the flow of data simply by withholding
acknowledgment. This procedure works fine and, indeed, can hardly be improved upon when
a message is sent in a few large frames. However, it is often the case that a source will break
up a large block of data into smaller blocks and transmit the data in many frames. This is
done for the following reasons:

1. The buffer size of the receiver may be limited.


2. The longer the transmission, the more likely that there will be an error, necessitating
retransmission of the entire frame. With smaller frames, errors are detected sooner,
and a smaller amount of data needs to be retransmitted.
3. On a shared medium, such as a LAN, it is usually desirable not to permit one station
to occupy the medium for an extended period, thus causing long delays at the other
sending stations.

With the use of multiple frames for a single message, the stop-and-wait procedure may be
inadequate. The essence of the problem is that only one frame at a time can be in transit.

3.1.2. Sliding Window Protocol:

Efficiency can be greatly improved by allowing multiple frames to be in transit at the same
time.

Several additional comments need to be made. Because the sequence number to be used
occupies a field in the frame, it is limited to a range of values. For example, for a 3-bit field,
the sequence number can range from 0 to 7. Accordingly, frames are numbered modulo 8;
that is, after sequence number 7, the next number is 0. In general, for a k-bit field the range of
sequence numbers is 0 through 2k-1, and frames are numbered modulo 2k. As will be shown
subsequently, the maximum window size is 2k - 1.
For example, assumes a 3-bit sequence number field and a maximum window size of seven
frames. Initially, A and B have windows indicating that A may transmit a group of maximum
seven frames, beginning with frame 0 (F0). After transmitting three frames (F0, F1, F2)
without acknowledgment, A has shrunk its window to four frames and maintains a copy of
the three transmitted frames. The window indicates that A may transmit four frames,
beginning with frame number 3. B then transmits an RR (receive ready) 3, which means “I
have received all frames up through frame number 2 and am ready to receive frame number
3; in fact, I am prepared to receive seven frames, beginning with frame number 3.” With this
acknowledgment, A is back up to permission to transmit seven frames, still beginning with
frame 3; also, A may discard the buffered frames that have now been acknowledged.
Proceeds to transmit frames 3, 4, 5, and 6. B returns RR 4, which acknowledges F3, and
allows transmission of F4 through the next instance of F2. By the time this RR reaches A, it
has already transmitted F4, F5, and F6, and therefore A may only open its window to permit
sending four frames beginning with F7.

If two stations exchange data, each needs to maintain two windows, one for transmit and one
for receive, and each side needs to send the data and acknowledgments to the other. To
provide efficient support for this requirement, a feature known as piggybacking is typically
provided. Each data frame includes a field that holds the sequence number of that frame plus
a field that holds the sequence number used for acknowledgment.

Thus, if a station has data to send and an acknowledgment to send, it sends both together in
one frame, saving communication capacity. Of course, if a station has an acknowledgment
but no data to send, it sends a separate acknowledgment frame, such as RR or RNR. If a
station has data to send but no new acknowledgment to send, it must repeat the last
acknowledgment sequence number that it sent. This is because the data frame includes a field
for the acknowledgment number, and some value must be put into that field. When a station
receives a duplicate acknowledgment, it simply ignores it.

Sliding-window flow control is potentially much more efficient than stop-and-wait flow
control. The reason is that, with sliding-window flow control, the transmission link is treated
as a pipeline that may be filled with frames in transit. By contrast, with stop-and-wait flow
control, only one frame may be in the pipe at a time.
3.2. Error Control for Lossy Medium

Error control refers to mechanisms to detect and correct errors that occur in the transmission
of frames. Here are three common elementary data link protocols for flow and error control
for reliable data transfer

3.2.1. Stop-and-Wait ARQ

In Stop-and-wait ARQ, the source station transmits a single frame and then must await an
acknowledgment (ACK). No other data frames can be sent until the destination station’s reply
arrives at the source station.

Two sorts of errors could occur. First, the frame that arrives at the destination could be
damaged. The receiver detects this by using the error-detection technique and simply discards
the frame. To account for this possibility, the source station is equipped with a timer. After a
frame is transmitted, the source station waits for an acknowledgment. If no acknowledgment
is received by the time that the timer expires, then the same frame is sent again. Note that this
method requires that the transmitter maintain a copy of a transmitted frame until an
acknowledgment is received for that frame.

Example: Following figure shows the transmission of a sequence of frames from source A to
destination B. The figure shows the two types of errors just described. The third frame
transmitted by A is lost or damaged and therefore B does not return an ACK. A times out and
retransmits the frame. Later, A transmits a frame labelled 1 but the ACK0 for that frame is
lost. A times out and retransmits the same frame. When B receives two frames in a row with
the same label, it discards the second frame but sends back an ACK0 to each. The principal
advantage of stop-and-wait ARQ is its simplicity. Its principal disadvantage is that stop-and-
wait is an inefficient mechanism. The sliding-window flow control technique can be adapted
to provide more efficient link utilization; in this context, it is sometimes referred to as
continuous ARQ.
3.2.2. Go-Back-N ARQ:

The form of error control based on sliding-window flow control that is most commonly used
is called go-back-N ARQ. In this method, a station may send a series of frames sequentially
numbered modulo some maximum value. The number of unacknowledged frames
outstanding is determined by window size, using the sliding-window flow control technique.
While no errors occur, the destination will acknowledge incoming frames as usual (RR =
receive ready, or piggybacked acknowledgment). If the destination station detects an error in
a frame, it may send a negative acknowledgment (REJ = reject) for that frame, as explained
in the following rules. The destination station will discard that frame and all future incoming
frames until the frame in error is correctly received. Thus, the source station, when it receives
a REJ, must retransmit the frame in error plus all succeeding frames that were transmitted in
the interim.

Suppose that station A is sending frames to station B. After each transmission, A sets an
acknowledgment timer for the frame just transmitted. Suppose that B has previously
successfully received frame (i-1) and A has just transmitted frame i. The go-back-N
technique takes into account the following contingencies:

Damaged frame: If the received frame is invalid (i.e., B detects an error, or the frame is so
damaged that B does not even perceive that it has received a frame), B discards the frame and
takes no further action as the result of that frame. There are two subcases:
a. Within a reasonable period of time, A subsequently sends frame (i + 1). B receives
frame (i+1) out of order and sends a REJ i. A must retransmit frame i and all
subsequent frames.
b. A does not soon send additional frames. B receives nothing and returns neither an RR
nor a REJ. When A’s timer expires, it transmits an RR frame that includes a bit
known as the P bit, which is set to 1. B interprets the RR frame with a P bit of 1 as a
command that must be acknowledged by sending an RR indicating the next frame that
it expects, which is frame i. When A receives the RR, it retransmits frame i.
Alternatively, A could just retransmit frame i when its timer expires.

Damaged RR: There are two subcases:

a. B receives frame i and sends RR (i+1), which suffers an error in transit. Because
acknowledgments are cumulative (e.g., RR 6 means that all frames through 5 are
acknowledged), it may be that A will receive a subsequent RR to a subsequent frame
and that it will arrive before the timer associated with frame i expires.

b. If A’s timer expires, it transmits an RR command as in Case 1b. It sets another


timer, called the P-bit timer. If B fails to respond to the RR command, or if its
response suffers an error in transit, then A’s P-bit timer will expire. At this point, A
will try again by issuing a new RR command and restarting the P-bit timer. This
procedure is tried for a number of iterations. If A fails to obtain an acknowledgment
after some maximum number of attempts, it initiates a reset procedure.

Damaged REJ: If a REJ is lost, this is equivalent to Case 1b.

3.2.3. Selective reject ARQ:

Below figure illustrates Selective reject ARQ scheme. When frame 5 is received out of order,
B sends a SREJ 4, indicating that frame 4 has not been received. However, B continues to
accept incoming frames and buffers them until a valid frame 4 is received. At that point, B
can place the frames in the proper order for delivery to higher-layer software.

In general, for a k-bit sequence number field in the frame header, which provides a sequence
number range of 2k, the maximum window size is limited to 2k-1.
3.3. High-Level Data Link Control (HDLC)

The most important data link control protocol is HDLC (ISO 3009, ISO 4335). Not only is
HDLC widely used, but it is the basis for many other important data link control protocols,
which use the same or similar formats and the same mechanisms as employed in HDLC.

3.3.1. Basic Characteristics:

To satisfy a variety of applications, HDLC defines three types of stations, two link
configurations, and three data transfer modes of operation.

The three station types are:

➢ Primary station: Responsible for controlling the operation of the link. Frames issued
by the primary are called commands.
➢ Secondary station: Operates under the control of the primary station. Frames issued
by a secondary are called responses. The primary maintains a separate logical link
with each secondary station on the line.
➢ Combined station: Combines the features of primary and secondary. A combined
station may issue both commands and responses.

The two link configurations are:

➢ Unbalanced configuration: Consists of one primary and one or more secondary


stations and supports both full-duplex and half-duplex transmission.
➢ Balanced configuration: Consists of two combined stations and supports both full-
duplex and half-duplex transmission.

The three data transfer modes are

➢ Normal response mode (NRM): Used with an unbalanced configuration. The primary
may initiate data transfer to a secondary, but a secondary may only transmit data in
response to a command from the primary.

➢ Asynchronous balanced mode (ABM): Used with a balanced configuration. Either


combined station may initiate transmission without receiving permission from the
other combined station.

➢ Asynchronous response mode (ARM): Used with an unbalanced configuration. The


secondary may initiate transmission without explicit permission of the primary. The
primary still retains responsibility for the line, including initialization, error recovery,
and logical disconnection.

NRM is used on multidrop lines, in which a number of terminals are connected to a host
computer. The computer polls each terminal for input. NRM is also sometimes used on point-
to-point links, particularly if the link connects a terminal or other peripheral to a computer.
ABM is the most widely used of the three modes; it makes more efficient use of a full-duplex
point-to-point link because there is no polling overhead. ARM is rarely used; it is applicable
to some special situations in which a secondary may need to initiate transmission.

3.3.2. HDLC Frame Format

HDLC uses synchronous transmission. All transmissions are in the form of frames, and a
single frame format suffices for all types of data and control exchanges. Figure given below
depicts the structure of the HDLC frame. The flag, address, and control fields that precede the
information field are known as a header. The frame check sequence and flag fields following
the data field are referred to as a trailer.

Flag Field:

Flag fields delimit the frame at both ends with the unique pattern 01111110. A single flag
may be used as the closing flag for one frame and the opening flag for the next. On both sides
of the user-network interface, receivers are continuously hunting for the flag sequence to
synchronize on the start of a frame. While receiving a frame, a station continues to hunt for
that sequence to determine the end of the frame.

Because the protocol allows the presence of arbitrary bit patterns (i.e., there are no
restrictions on the content of the various fields imposed by the link protocol), there is no
assurance that the pattern 01111110 will not appear somewhere inside the frame, thus
destroying synchronization. To avoid this problem, a procedure known as bit stuffing is
used. For all bits between the starting and ending flags, the transmitter inserts an extra 0 bit
after each occurrence of five 1’s in the frame. After detecting a starting flag, the receiver
monitors the bit stream. When a pattern of five 1’s appears, the sixth bit is examined. If this
bit is 0, it is deleted. If the sixth bit is a 1 and the seventh bit is a 0, the combination is
accepted as a flag. If the sixth and seventh bits are both 1, the sender is indicating an abort
condition. With the use of bit stuffing, arbitrary bit patterns can be inserted into the data field
of the frame. This property is known as data transparency.

Example of bit stuffing.

Address Field: The address field identifies the secondary station that transmitted or is to
receive the frame. This field is not needed for point-to-point links but is always included for
the sake of uniformity. The address field is usually 8 bits long but, by prior agreement, an
extended format (shown in fig. b) may be used in which the actual address length is a
multiple of 7 bits. The leftmost bit of each octet is 1 or 0 according as it is or is not the last
octet of the address field. The remaining 7 bits of each octet form part of the address. The
single-octet address of 11111111 is interpreted as the all stations address in both basic and
extended formats. It is used to allow the primary to broadcast a frame for reception by all
secondaries.

Control Field: HDLC defines three types of frames, each with a different control field
format. Information frames (I-frames) carry the data to be transmitted for the user.
Additionally, flow and error control data, using the ARQ mechanism, are piggybacked on an
information frame. Supervisory frames (S-frames) provide the ARQ mechanism when
piggybacking is not used. Unnumbered frames (U-frames) provide supplemental link control
functions. The first one or two bits of the control field serves to identify the frame type. The
remaining bit positions are organized into subfields as indicated in Figures c (8-bit control
field) and d (16-bit control field).

All of the control field formats contain the poll/final (P/F) bit. Its use depends on context.
Typically, in command frames, it is referred to as the P bit and is set to 1 to solicit (poll) a
response frame from the peer HDLC entity. In response frames, it is referred to as the F bit
and is set to 1 to indicate the response frame transmitted as a result of a soliciting command.

Note that the basic control field for S- and I-frames uses 3-bit sequence numbers. With the
appropriate set-mode command, an extended control field can be used for S- and I-frames
that employs 7-bit sequence numbers. U-frames always contain an 8-bit control field.

Information Field: The information field is present only in I-frames and some U-frames.
The field can contain any sequence of bits but must consist of an integral number of octets.
The length of the information field is variable up to some system defined maximum.

Frame Check Sequence Field: The frame check sequence (FCS) is an error detecting code
calculated from the remaining bits of the frame, exclusive of flags. The normal code is the
16-bit CRC. An optional 32-bit FCS, using CRC-32, may be employed if the frame length or
the line reliability dictates this choice.

You might also like