Sie sind auf Seite 1von 12

Lovely Professional University

Department of CA
HOMEWORK-3

Homework Title/No: 3 Course Code: CAP 306


Course Instructor: Lect. Amandeep mam Course Tutor (if applicable): NA
Student’s Roll Number: RD3912A10 Section No.: D3912

Declaration:
I declare that this assignment is my individual work. I have not copied
from any other student’s work or from any other source except where due
acknowledgement is made explicitly in the text, nor has any part been written for me by
another person.

Student’s Sign:
Baninder kaur

Evaluator’sComments: ___________________________________________________

Marks obtained ____________ out of __________________


Part A

Q1:- Consider the use of 10 K size frames on a 10 Mbps satellite channel


with 270ms delay. What is the link utilization for stop and wait ARQ
technique?
Ans:-

Bandwidth of the link=10*106

Size of the frame =10*103

Delay =270*10-3s

Delay for 1 bit frame=10*103/270*10-3

Total link utilization is 10*107/270=0.37mbps

So link utilization =0.37/100=0.37 %

Q2:- Explain with example in what situation sliding window protocol


performs better than stop and wait protocol?
Ans:- Major Drawback of Stop-and-Wait Flow Control:

Only one frame can be in transmission at a time


This leads to inefficiency if propagation delay is much longer than the transmission
delay

Overcoming problem through Sliding Window Flow Control


 Allows transmission of multiple frames
 Assigns each frame a k-bit sequence number
 Range of sequence number is [0..2k-1], i.e., frames are counted modulo 2k

 With the use of multiple frames for a single message, the stop-and-wait protocol
does not perform well. Only one frame at a time can be in transit. In stop-and-wait
flow control, if a > 1, serious inefficiencies result.
 Efficiency can be greatly improved by allowing multiple frames to be in transit at
the same time. Efficiency can also be improved by making use of the full-duplex
line. To keep track of the frames, sender station sends sequentially numbered
frames. Since the sequence number to be used occupies a field in the frame, it
should be of limited size.
 If the header of the frame allows k bits, the sequence numbers range from 0 to 2k –
1. Sender maintains a list of sequence numbers that it is allowed to send (sender
window). The size of the sender’s window is at most 2k – 1. The sender is provided
with a buffer equal to the window size. Receiver also maintains a window of size 2k
– 1.
 The receiver acknowledges a frame by sending an ACK frame that includes the
sequence number of the next frame expected. This also explicitly announces that it
is prepared to receive the next N frames, beginning with the number specified.
 This scheme can be used to acknowledge multiple frames. It could receive frames
2, 3, 4 but withhold ACK until frame 4 has arrived. By returning an ACK with
sequence number 5, it acknowledges frames 2, 3, 4 in one go. The receiver needs a
buffer of size 1.

A sliding window algorithm places a buffer between the application program and the
network data flow.
Sending Window:

At any instant, the sender is permitted to send frames with sequence numbers in a
certain range (the sending window)

Receiving Window:

The receiver maintains a receiving window corresponding to the sequence numbers of


frames that are accepted.

• In the case we want to have a better link utilization a less delay and a fast
communication we would prefer a sliding window protocol over the stop and
wait protocol because the sliding window protocol is much better as compared
to the stop and wait protocol .

• In the case of the stop and wait protocol in which a frame is sent and the sender
waits for the acknowledgement that states that the packet has arrived at the
destination successfully.

This kind of technique is very time consuming or we can say that the delay is a
lot present in this protocol.The link utilization is very poor . whereas in the case of the
sliding window the acknowledgment are usually in the form of cumulative that means a
single acknowledgement is sufficient to acknowlege the whole transaction in the
single window .so this kind of protocol helps us achieve low delay and higher bandwith
utilization.

Data received from the network is stored in the buffer, from where the application can
read at its own pace. As the application reads data, buffer space is freed up to accept
more input from the network. The window is the amount of data that can be "read
ahead" - the size of the buffer, less the amount of valid data stored in it. Window
announcements are used to inform the remote host of the current window size.

“The Stop-and-Wait protocol is inefficient when large numbers of small packets


are send by the transmitter since the transmitter has to wait for the
acknowledgement of each individual packet before sending the next one. This
problem can be overcome by sliding window protocol. In sliding window protocol
multiple frames (up to a fixed number of frames) are send before receiving an
acknowledgement from the receiver."
Q3:- With respect to the data given below explain bit stuffing at receiver
and transmitter end.
“ 0001111111001111101000 “
Ans:- Data sent

0001111111001111101000

Sender end

In the bit stuffing the 0 is added at the every location before which 5 times 1 appear

000111110110011111001000

Receiver side

At the receiver end the zero followed by the five consecutive 1’s is destuffed and the
remaining is the data .

000111110110011111001000

Data received

0001111111001111101000

Part B

Q1 Compare the window size , number of bits used for numbering the
frames and buffer size for the three ARQ techniques.?

Ans:- Following is the ARQ technique followed by window size and no of bits:-

 Go Back 'n': If a frame is lost or received in error, the receiver may simply discard
all subsequent frames, sending no acknowledgments for the discarded frames. In this case
the receive window is of size 1.
 Since no acknowledgements are being received the sender's window will fill up,
the sender will eventually time out and retransmit all the unacknowledged frames
in order starting from the damaged or lost frame. The maximum window size for
this protocol can be obtained as follows.
 Assume that the window size of the sender is n. So the window will initially
contain the frames with sequence numbers from 0 to (w-1). Consider that the
sender transmits all these frames and the receiver's data link layer receives all of
them correctly. However, the sender's data link layer does not receive any
acknowledgements as all of them are lost. So the sender will retransmit all the
frames after its timer goes off.
 However the receiver window has already advanced to w. Hence to avoid
overlap , the sum of the two windows should be less than the sequence number
space.
w-1 + 1 < Sequence Number Space
i.e., w < Sequence Number Space
Maximum Window Size = Sequence Number Space - 1

 Selective Repeat: In this protocol rather than discard all the subsequent frames
following a damaged or lost frame, the receiver's data link layer simply stores them in
buffers.
 When the sender does not receive an acknowledgement for the first frame it's
timer goes off after a certain time interval and it retransmits only the lost frame.
Assuming error - free transmission this time, the sender's data link layer will have
a sequence of a many correct frames which it can hand over to the network layer.
 Thus there is less overhead in retransmission than in the case of Go Back n
protocol.
In case of selective repeat protocol the window size may be calculated as follows.
Assume that the size of both the sender's and the receiver's window is w. So
initially both of them contain the values 0 to (w-1).
 Consider that sender's data link layer transmits all the w frames, the receiver's
data link layer receives them correctly and sends acknowledgements for each of
them. However, all the acknowledgemnets are lost and the sender does not
advance it's window.
 The receiver window at this point contains the values w to (2w-1). To avoid
overlap when the sender's data link layer retransmits, we must have the sum of
these two windows less than sequence number space. Hence, we get the condition

In selective repeat, the receiver's window size is more than one, and the receiver can
receive a fixed number of out of order frames equal to the window size. If a frame is
received with an error it simply sends a 'negative acknowledgement' signal
corresponding to the faulty frame prompting the sender to resend the frame.

In the meantime, the recipient can store the subsequent frames, which have
already been sent, in a buffer and wait for the remaining frame to be received. Once
received, the frames are transferred in sequence to the network layer.

Maximum Window Size = Sequence Number Space / 2

Following exists the relationship between sending window size and sequence
number:-

• Sending window size, Ws


• Sequence number is m-bits long

Following represents their correlations:-

1 window size
the window size states the size if the data or we can say the number of the frames
after which a stop encounters and the protocol waits for the acknowledgement to
appear from the other end . this size varies . This helps us to achieve the link
utilization efficiency .

2 numbering of the frame

The numbering of the frame can be represented using a single bit because as in
the case of a stop and wait protocol a single frame is transferred at the single time
so it can be numbered 0 or 1 by adopting this technique we can save memory .

3 Buffer size

Buffer size varies from the sender to receiver in the case of the arq the buffer size
on the data to be transmitted for example in the case of the sliding window
prorocol if we have to transmit 10 frames then we require Buffer of 10 at the
sender end where as on the receiver end a single buffer is sufficient .

Maximum Allowable Sending Window Size max(Ws) = 2m-1


Following represents the relationship between sending window size and no of
bits used for numbering the frames:-

• Timer will be greater than 2tprop to allow time for the ACK to return.
• Therefore, the whole window needs to be retransmitted and N = Ws

• N is simply the number of frames that were transmitted between the lost/errored
frame and the time that the sender timer times out

Q2. Why are asynchronous protocols losing popularity and bit


oriented protocols gaining popularity ?
Ans :- BIT ORIENTED PROTOCOL

HDLC
All bit-oriented protocols are related to high-level data link control(HDLC), which
published by ISO.
• HDLC support both half-duplex and full-duplex modes in point-to-
point and multipoint configurations
• HDLC can be characterized by their station types, their their
configurations, and their response modes

Mode of communication
~ describes who controls the link

• NRM(Normal Response Mode)


• ARM(Asynchronous Response Mode)
• ABM(Asynchronous Balanced Mode)

ASYNCHRONOUS PROTOCOL

They are used primarily in modems, feature start and stop bits and variable length gabs
between characters

There are certain reasons due to which the asynchronous protocols are losing
popularity and the the bit oriented protocols are gaining .

 The bit oriented protocol are capable of utilizing the bandwith available in a
proper manner as compared to the asynchronous protocols

 In the case of the asynchronous protocols tha delay is very high as compared to
the bit oriented protocols

 In the case of the asynchronous protocols the one bit is transmited at a time
whereas in the case of the bit oriented protocols multiple frames can be
transferred at a given time for example in the case of the sliding window protocol.

Major reasons for the popularity of bit.oriented protocol are:-

 Bit-oriented protocols also use a unique character (technically, it is just an


arbitrary bit-string) for frame delineation, which is the FLAG. This character
provides frame synchronization. All bits between two occurrences of FLAGs
constitute a frame.
 The FLAG is a 0 bit, followed by six 1 bits, followed by another 0 bit. In order
that the FLAG character not appear mistakenly in the data of the message, the
sender inserts (and the receiver removes) an extra 0 bit after any five successive 1
bits in the data stream.

 Because this insertion of bits ("stuffing") results in arbitrary frame bit-lengths,


bit-oriented protocols are generally useful only in synchronous transmission
environments.
 Bit-oriented procedures do not require that the number of bits between FLAGs be
an exact number of 8-bit characters, in distinction to character-oriented protocols
and DDCMP. The necessity for character-alignment may be imposed at higher
layers, as it is, for example, in X.25 Network Layer.

Q3 In HDLC why do we need bit stuffing ?


Ans:- Bit suffing use special bit patterns or ags at the start and end of frames.

To prevent the possibility of confusion due to user data that contains the ag patterns we
use bit stuffing. We add bits to the user data whenever to prevent the ags from occurring
in data. For example, HDLC uses a ag of 01111110; The HDLC bit stuffing rule is as
follows:
after any sequence of 1's in the user data, add a 0. Of course at the receiving end the user
data must be destuffed: after any 1's in the data, the next 0 is removed.

In the case of the HDLC we need the bit stuffing to provide data transparency .

For example :- the HDLC uses the 3 bit stuffing for the sequence numbering of
the frames during transmission . so we can keep the 7 frames using the 3 bit stuffing .

So suppose the data is 01111110. After passing it to the stuffing sublayer the
\coded" data bits becomes 011111010. After adding a flags at the start and
end, it becomes 0111111001111101001111110. When it gets to the
receiver, the receiver deframing layer spots the frame and strips the ags to
get 011111010. Then the destuffng sublayer removes stuffed bits to yield
01111110

“HDLC uses zero insertion/deletion process (commonly known as bit stuffing) to


ensure that the bit pattern of the delimiter flag does not occur in the fields between
flags. The HDLC frame is synchronous and therefore relies on the physical layer to
provide method of clocking and synchronizing the transmission and reception of
frames.”
Following represents the bit- stuffing in HDLC
HDLC
frame
Flag Address Control Information FCS Flag
any number of
bits
 Frame delineated by flag character
 HDLC uses bit stuffing to prevent occurrence of flag 01111110 inside the frame
 Transmitter inserts extra 0 after each consecutive five 1s inside the frame
 Receiver checks for five consecutive 1s
 if next bit = 0, it is removed
 if next two bits are 10, then flag is detected
 If next two bits are 11, then frame has errors

Bit stuffing and destuffing in HDLC

So, In order to ensure that the bit pattern of the frame delimiter flag does not appear in
the data field of the frame (and therefore cause frame misalignment), a technique known
as Bit Stuffing is used by both the transmitter and the receiver.

Das könnte Ihnen auch gefallen