Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 3.2

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 23

Chapter 3

The Data Link Layer


• Convert bit stream
to frame.
Network Layer • Compute
Checksum.
• If source & receiver
checksum is not
equal, discard it.
Data Link Layer
• If channel is noisy,
add some extra bit
Taking raw bit stream form
to reduce error rate.
physical layer • Bits may be less or
grater than actual
Physical Layer bits
Breaking up the bit stream into frames is quite
difficult task.
Four methods for this purpose:
1.Byte count.
2.Flag bytes with byte stuffing.
3.Flag bits with bit stuffing.
4.Physical layer coding violations.
Byte count:
•Uses a field in the header to specify the number
of bytes in the frame.
•At receiver end knows how many bytes follow
and hence where the end of the frame is.
Byte count: Disadvantages:
•Transmission Error: If one or more bit(s)
changed than receiver unable to synchronous.
•So unable to locate the correct start of the next
frame.
•Retransmission: Difficult due to know how
many bytes to skip over to get to the start of the
retransmission.
•That’s why this method is rarely used.
Flag bytes with byte stuffing:
•A flag byte, is used as both the starting and
ending delimiter.
•Two consecutive flag bytes indicate the end of
one frame and the start of the next.
•Thus, if the receiver ever loses synchronization it
can just search for two flag bytes to find the end of
the current frame and the start of the next frame.
Flag bytes with byte stuffing:[2]
•What happened when flag byte occurs in the data,
especially in large data?
• Solution: Sender’s data link layer insert a special
escape byte (ESC) just before each ‘‘accidental’’
flag byte in the data.
Flag bits with bit stuffing:
•So far we used byte in previous two methods.
•Framing can be done in bit level.
•Develop for HDLC (High level Data Link
Control) protocol.
•Each frame begins and ends with a special bit
pattern, 01111110 or 0x7E in hexadecimal.
Physical layer coding violations:
•Encoding of bits as signals or vice-versa.
•Redundancy bits, Redundancy means that some
signals will not occur in regular data.
•For example, in the 4B/5B line code 4 data bits
are mapped to 5 signal bits to ensure sufficient bit
transitions.
•This means that 16 out of the 32 signal
possibilities are not used.
Two Ways:

Error Detecting Code Error Correcting Code

Hamming codes. Parity.


Binary convolutional codes. Checksums.
Reed-Solomon codes. Cyclic Redundancy Checks
(CRCs).
Low-Density Parity Check codes.
Flow Control
• It does not worry about the possibility of
anything going wrong.
• Data are transmitted in one direction only.
• Both the transmitting and receiving network
layers are always ready.
• Processing time can be ignored.
• Infinite buffer space is available.
• And best of all, the communication channel
between the data link layers never damages or
loses frames.
• Preventing the sender from flooding the
receiver with frames.
• Solution: To build the receiver to be powerful
enough to process a continuous frame stream :P
• It must have sufficient buffering and processing
abilities to run at the line rate.
• Best Solution: The sender sends one frame and
then waits for an acknowledgement before
proceeding.
• This process is called stop-and-wait protocol.
• Frames may be either damaged or lost
completely.
• If a frame is damaged in transit, the receiver
hardware will detect this when it computes the
checksum.
• The sender could send a frame, but the receiver
would only send an acknowledgement frame if
the data were correctly received.
Scenario to be consider:
1.The network layer on A gives packet 1 to its data link
layer. The packet is correctly received at B and passed to
the network layer on B. B sends an acknowledgement
frame back to A.
2.The acknowledgement frame gets lost completely.
3.The data link layer on A eventually times out. Not having
received an acknowledgement.
4.The duplicate frame also arrives intact at the data link
layer on B and is unwittingly passed to the network layer
there.
Simple Stop and Wait

Sender:
1) Send one data packet at a time.
2) Send next packet only after receiving
acknowledgement for previous.
Receiver:
1) Send acknowledgement after receiving and
consuming of data packet.
2) After consuming packet acknowledgement
need to be sent (Flow Control)
Simple Stop and Wait
Problems :
1. Lost Data

2. Lost Acknowledgement
Stop and Wait ARQ (Automatic Repeat Request)

3. Delayed Acknowledgement/Data: After timeout on sender side, a long delayed


acknowledgement might be wrongly considered as acknowledgement of some other
recent packet.

Above 3 problems are resolved by Stop and Wait ARQ (Automatic Repeat Request)
that does both error control and flow control.
Stop and Wait ARQ (Automatic Repeat Request)

1. Time out
Stop and Wait ARQ (Automatic Repeat Request)

2. Sequence number
Stop and Wait ARQ (Automatic Repeat Request)

3. Delayed Acknowledgement:
This is resolved by introducing sequence number for acknowledgement also.
Discussion about Stop & Wait

a)The Stop and Wait ARQ solves main three problems, but may cause big performance
issues as sender always waits for acknowledgement even if it has next packet ready to
send. Consider a situation where you have a high bandwidth connection and
propagation delay is also high (you are connected to some server in some other country
though a high speed connection). To solve this problem, we can send more than one
packet at a time with a larger sequence numbers.
b)So Stop and Wait ARQ may work fine where propagation delay is very less for
example LAN connections, but performs badly for distant connections like satellite
connection
Difference between S&W and Sliding
S.N STOP-AND-WAIT PROTOCOL SLIDING WINDOW PROTOCOL
O
1. In Stop-and-Wait Protocol, sender send In sliding window protocol, sender send more
one frame and wait for the than one frames to the receiver side and re-
acknowledgment from receiver side. transmit the frame which are/is damaged or
suspected.

2. Efficiency of Stop-and-Wait Protocol is Efficiency of sliding window protocol is more


less. than Stop-and-Wait Protocol.

3. Sender window size of Stop-and-Wait Sender window size of sliding window


Protocol is 1. protocol is N.
4. Receiver window size of Stop-and-Wait Receiver window size of sliding window
Protocol is 1. protocol may 1 or N.
5. In Stop-and-Wait Protocol, sorting is not In sliding window protocol, sorting may be or
necessary. may not be necessary.

6. Efficiency of Stop-and-Wait Protocol is1/ Efficiency of sliding window protocol is


(1+2*a) N/(1+2*a)
7. Stop-and-Wait Protocol is half duplex. Sliding window protocol is full duplex.
• All of above protocol deal with one way
communication. [half-duplex]
• In real world need two way [full-duplex]
communication.
• Data frames and ack frames going in same direction. 
• It controls the speed of transmission so that no fast
sender can overwhelm the slower receiver;
• It allows for orderly delivery.
• It allows for retransmission of lost frames, specific
retransmission policy depends on the specific
implementations.

You might also like