Data Link Control-Data Communication Systems-Assignment Solution, Exercises of Data Communication Systems and Computer Networks

This file contains solution to problems related Data Communication Systems. Mr. Prajin Ahuja assigned task at Birla Institute of Technology and Science. Its main points are: Data, Questions, Solutions, Media, Access, Byte-oriented, Protocol, Error, Selective-Repeat, Piggybacking

Typology: Exercises

2011/2012

Uploaded on 07/26/2012

waania
waania 🇮🇳

4.4

(31)

119 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CHAPTER 11
Data Link Control
Solutions to Odd-Numbered Review Questions and Exercises
Review Questions
1. The two main functions of the data link layer are data link control and media
access control. Data link control deals with the design and procedures for commu-
nication between two adjacent nodes: node-to-node communication. Media access
control deals with procedures for sharing the link.
3. In a byte-oriented protocol, data to be carried are 8-bit characters from a coding
system. Character-oriented protocols were popular when only text was exchanged
by the data link layers. In a bit-oriented protocol, the data section of a frame is a
sequence of bits. Bit-oriented protocols are more popular today because we need to
send text, graphic, audio, and video which can be better represented by a bit pat-
tern than a sequence of characters.
5. Flow control refers to a set of procedures used to restrict the amount of data that
the sender can send before waiting for acknowledgment. Error control refers to a
set of procedures used to detect and correct errors.
7. In this chapter, we discussed three protocols for noisy channels: the Stop-and-Wait
ARQ, the Go-Back-N ARQ, and the Selective-Repeat ARQ.
9. In the Go-Back-N ARQ Protocol, we can send several frames before receiving
acknowledgments. If a frame is lost or damaged, all outstanding frames sent before
that frame are resent. In the Selective- Repeat ARQ protocol we avoid unnecessary
transmission by sending only the frames that are corrupted or missing. Both Go-
Back-N and Selective-Repeat Protocols use sliding windows. In Go-Back-N ARQ,
if m is the number of bits for the sequence number, then the size of the send win-
dow must be at most 2m1; the size of the receiver window is always 1. In Selec-
tive-Repeat ARQ, the size of the sender and receiver window must be at most 2m1.
11. Piggybacking is used to improve the efficiency of bidirectional transmission.
When a frame is carrying data from A to B, it can also carry control information
about frames from B; when a frame is carrying data from B to A, it can also carry
control information about frames from A.
docsity.com
pf3
pf4
pf5
pf8

Partial preview of the text

Download Data Link Control-Data Communication Systems-Assignment Solution and more Exercises Data Communication Systems and Computer Networks in PDF only on Docsity!

CHAPTER 11

Data Link Control

Solutions to Odd-Numbered Review Questions and Exercises

Review Questions

  1. The two main functions of the data link layer are data link control and media access control. Data link control deals with the design and procedures for commu- nication between two adjacent nodes: node-to-node communication. Media access control deals with procedures for sharing the link.
  2. In a byte-oriented protocol , data to be carried are 8-bit characters from a coding system. Character-oriented protocols were popular when only text was exchanged by the data link layers. In a bit-oriented protocol , the data section of a frame is a sequence of bits. Bit-oriented protocols are more popular today because we need to send text, graphic, audio, and video which can be better represented by a bit pat- tern than a sequence of characters.
  3. Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. Error control refers to a set of procedures used to detect and correct errors.
  4. In this chapter, we discussed three protocols for noisy channels: the Stop-and-Wait ARQ , the Go-Back-N ARQ , and the Selective-Repeat ARQ.
  5. In the Go-Back-N ARQ Protocol , we can send several frames before receiving acknowledgments. If a frame is lost or damaged, all outstanding frames sent before that frame are resent. In the Selective- Repeat ARQ protocol we avoid unnecessary transmission by sending only the frames that are corrupted or missing. Both Go- Back- N and Selective-Repeat Protocols use sliding windows. In Go-Back- N ARQ, if m is the number of bits for the sequence number, then the size of the send win- dow must be at most 2 m1 ; the size of the receiver window is always 1. In Selec- tive-Repeat ARQ, the size of the sender and receiver window must be at most 2 m −^1.
  6. Piggybacking is used to improve the efficiency of bidirectional transmission. When a frame is carrying data from A to B, it can also carry control information about frames from B; when a frame is carrying data from B to A, it can also carry control information about frames from A.

Exercises

  1. We give a very simple solution. Every time we encounter an ESC or flag character, we insert an extra ESC character in the data part of the frame (see Figure 11.1).
  2. We write two very simple algorithms. We assume that a frame is made of a one- byte beginning flag, variable-length data (possibly byte-stuffed), and a one-byte ending flag; we ignore the header and trailer. We also assume that there is no error during the transmission. a. Algorithm 11.1 can be used at the sender site. It inserts one ESC character whenever a flag or ESC character is encountered.

b. Algorithm 11.2 can be used at the receiver site.

  1. A five-bit sequence number can create sequence numbers from 0 to 31. The sequence number in the Nth packet is (N mod 32). This means that the 101th packet has the sequence number (101 mod 32) or 5.

Figure 11.1 Solution to Exercise 13

Algorithm 11.1 Sender’s site solution to Exercise 15 InsertFrame (one-byte flag); // Insert beginning flag while (more characters in data buffer) { ExtractBuffer (character); if (character is flag or ESC) InsertFrame (ESC); // Byte stuff InsertFrame (character); } InsertFrame (one-byte flag); // Insert ending flag

Algorithm 11.2 Receiver’s site solution to Exercise 15 ExtractFrame (character); // Extract beginning flag Discard (character); // Discard beginning flag while ( more characters in the frame) { ExtractFrame (character); if (character = = flag) exit(); // Ending flag is extracted

if (character = = ESC) { Discard (character); // Un-stuff ExtractFrame (character); // Extract flag or ESC as data } InsertBuffer (character); } Discard (character); // Discard ending flag

ESC ESC ESC Flag ESC ESC ESC ESC ESC ESC ESC Flag

  1. Algorithm 11.5 shows one design. This is a very simple implementation in which we assume that both sites always have data to send.

StopTimer (); PurgeFrame (S (^) n−1 , R (^) n−1); //Copy is not needed canSend = true; } }

if (Event(TimeOut)) // The timer expired { StartTimer (); ResendFrame (S (^) n -1 , R (^) n-1); // Resend a copy } } // End Repeat forever

Algorithm 11.5 A bidirectional algorithm for Selective-Repeat ARQ

S (^) w = 2 m−^1 ; S (^) f = 0; S (^) n = 0; R (^) n = 0; NakSent = false; AckNeeded = false; Repeat (for all slots); Marked (slot) = false; while (true) // Repeat forever { WaitForEvent (); if (Event (RequestToSend)) // There is a packet to send { if (S (^) n−S (^) f >= S (^) w) Sleep (); // If window is full GetData (); MakeFrame (S (^) n , R (^) n); StoreFrame (S (^) n , R (^) n); SendFrame (S (^) n , R (^) n); S (^) n = S (^) n + 1; StartTimer (S (^) n); }

if (Event (ArrivalNotification)) { Receive (frame); // Receive Data or NAK if (FrameType is NAK) { if (corrupted (frame)) Sleep(); if (nakNo between S (^) f and S (^) n) { resend (nakNo); StartTimer (nakNo); } }

Algorithm 11.4 A bidirectional algorithm for Stop-And-Wait ARQ

  1. State R (^) n = 0 means the receiver is waiting for Frame 0. State Rn = 1 means the receiver is waiting for Frame 1. We can then say

if (FrameType is Data) { if (corrupted (Frame)) AND (NOT NakSent) { SendNAK (R (^) n ); NakSent = true; Sleep(); }

if (ackNo between S (^) f and S (^) n ) { while (S (^) f < ackNo) { Purge (S (^) f ); StopTimer (S (^) f); S (^) f = S (^) f + 1; } }

if ((seqNo <> R (^) n ) AND (NOT NakSent)) { SendNAK (R (^) n ); NakSent = true; }

if ((seqNo in window) AND (NOT Marked (seqNo)) { StoreFrame (seqNo); Marked (seqNo) = true; while (Marked (R (^) n)) { DeliverData (R (^) n); Purge (R (^) n); R (^) n = R (^) n + 1; AckNeeded = true; } } } // End if (FrameType is Data) } // End if (arrival event)

if (Event (TimeOut (t))) // The timer expires { StartTimer (t); SendFrame (t); } } // End Repeat forever

Event A : Receiver Site: Frame 0 received. Event B : Receiver Site: Frame 1 received.

Algorithm 11.5 A bidirectional algorithm for Selective-Repeat ARQ

Delay for 1 window = 7 + 25 + 25 = 57 ms.

Total delay = 143 × 57 ms = 8.151 s