Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Data Link Layer 2 Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error.

Similar presentations


Presentation on theme: "The Data Link Layer 2 Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error."— Presentation transcript:

1 The Data Link Layer 2 Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Example Data Link Protocols Revised: August 2011

2 The Data Link Layer CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Responsible for delivering frames of information over a single link Handles transmission errors and regulates the flow of data Physical Link Network Transport Application

3 TUNALI Computer Networks 1 3 Assumptions Source and destination are directly connected to each other There can be an error during the transmission The channel has finite data rate There is a nonzero propagation delay Purpose Develop algorithms for reliable and efficient communication between the source and the destination

4 TUNALI Computer Networks 1 4 Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.

5 Link layer environment (2) Link layer protocol implementations use library functions See code ( protocol.h ) for more details CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 GroupLibrary FunctionDescription Network layer from_network_layer(&packet) to_network_layer(&packet) enable_network_layer() disable_network_layer() Take a packet from network layer to send Deliver a received packet to network layer Let network cause “ready” events Prevent network “ready” events Physical layer from_physical_layer(&frame) to_physical_layer(&frame) Get an incoming frame from physical layer Pass an outgoing frame to physical layer Events & timers wait_for_event(&event) start_timer(seq_nr) stop_timer(seq_nr) start_ack_timer() stop_ack_timer() Wait for a packet / frame / timer event Start a countdown timer running Stop a countdown timer from running Start the ACK countdown timer Stop the ACK countdown timer

6 Sliding Window Protocols CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Sliding Window concept » One-bit Sliding Window » Go-Back-N » Selective Repeat »

7 Sliding Window concept (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Sender maintains window of frames it can send Needs to buffer them for possible retransmission Window advances with next acknowledgements Receiver maintains window of frames it can receive Needs to keep buffer space for arrivals Window advances with in-order arrivals

8 Sliding Window concept (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 A sliding window advancing at the sender and receiver Ex: window size is 1, with a 3-bit sequence number. At the start First frame is sent First frame is received Sender gets first ack Sender Receiver

9 Sliding Window concept (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Larger windows enable pipelining for efficient link use Stop-and-wait (w=1) is inefficient for long links Best window (w) depends on bandwidth-delay (BD) Want w ≥ 2BD+1 to ensure high link utilization Pipelining leads to different choices for errors/buffering We will consider Go-Back-N and Selective Repeat

10 TUNALI Computer Networks 1 10 Sliding Window Protocols Previous protocols involved transmission of data frames in only one direction In practice, two way data communication is necessary One way to achieve this is to have two lines each having forward and backward channels each implementing Protocol 2 This will waste bandwidth Better way is to use the same circuit for data in both directions There will be data and ack frames in each direction

11 TUNALI Computer Networks 1 11 Piggybacking The performance is further improved by attaching ack to an outgoing data frame instead of sending a separate ack frame. (piggybacking) Unnecessary overhead of sending a separate frame for ack is avoided Question: How long should data link layer wait for a packet onto which to piggyback the ack? Answer: It starts an ack timer. If a data frame is received from the network layer in the mean time, ack is piggybacked,. if not, a separate ack frame is sent

12 TUNALI Computer Networks 1 12 Sliding Window Parameters Sequence numbers of frames range from 0 to 2 n –1 where n will be specified later for each protocol Sending Window A set of sequence numbers of frames the sender is permitted to send Receiving Window A set of sequence numbers of frames the receiver is permitted to accept

13 TUNALI Computer Networks 1 13 Sliding Window Assumptions The protocol must deliver packets to the destination network layer in the same order that they were passed to the data link layer on the sending machine Physical communication channel must deliver all frames in the order sent The senders window contains frames sent but not ack’ed yet When a packet from network layer is received, the upper edge of the window is advanced When ack is received, lower edge of the window is advanced

14 TUNALI Computer Networks 1 14 Receiver Window Any frame falling outside the window is discarded When a frame whose sequence number is equal to the lower edge of the window is received, it is passed to the network layer An ack is generated Window is rotated by one The receiver window always remains at its initial size

15 TUNALI Computer Networks 1 15 A One Bit Sliding Window Protocol Sender and receiver window size is 1 Frame sequence numbers are 0 and 1 The ack field contains the number of the last frame received without error No combination of lost frames or premature timeouts can cause the protocol to deliver duplicate packets to either network layer, or to skip a packet, or o get into a deadlock.

16 One-Bit Sliding Window (1) Transfers data in both directions with stop-and-wait Piggybacks acks on reverse data frames for efficiency Handles transmission errors, flow control, early timers CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011... { Each node is sender and receiver (p4): Prepare first frame Launch it, and set timer

17 One-Bit Sliding Window (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011... If a frame with new data then deliver it Wait for frame or timeout (Otherwise it was a timeout) If an ack for last send then prepare for next data frame Send next data frame or retransmit old one; ack the last data we received

18 Two scenarios show subtle interactions exist in p4: −Simultaneous start [right] causes correct but slow operation compared to normal [left] due to duplicate transmissions. Time Normal caseCorrect, but poor performance One-Bit Sliding Window (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Notation is (seq, ack, frame number). Asterisk indicates frame accepted by network layer.

19 Go-Back-N (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Receiver only accepts/acks frames that arrive in order: Discards frames that follow a missing/errored frame Sender times out and resends all outstanding frames

20 Go-Back-N (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Tradeoff made for Go-Back-N: Simple strategy for receiver; needs only 1 frame Wastes link bandwidth for errors with large windows; entire window is retransmitted Implemented as p5 (see code in book)

21 Selective Repeat (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Receiver accepts frames anywhere in receive window Cumulative ack indicates highest in-order frame NAK (negative ack) causes sender retransmission of a missing frame before a timeout resends window

22 Selective Repeat (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Tradeoff made for Selective Repeat: More complex than Go-Back-N due to buffering at receiver and multiple timers at sender More efficient use of link bandwidth as only lost frames are resent (with low error rates) Implemented as p6 (see code in book)

23 Selective Repeat (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 For correctness, we require: Sequence numbers (s) at least twice the window (w) Originals Retransmits Error case (s=8, w=7) – too few sequence numbers Correct (s=8, w=4) – enough sequence numbers New receive window overlaps old – retransmits ambiguous New and old receive window don’t overlap – no ambiguity

24 TUNALI Computer Networks 1 24 Receiver Window Any frame falling outside the window is discarded When a frame whose sequence number is equal to the lower edge of the window is received, it is passed to the network layer An ack is generated Window is rotated by one The receiver window always remains at its initial size

25 TUNALI Computer Networks 1 25 A One Bit Sliding Window Protocol Sender and receiver window size is 1 Frame sequence numbers are 0 and 1 The ack field contains the number of the last frame received without error No combination of lost frames or premature timeouts can cause the protocol to deliver duplicate packets to either network layer, or to skip a packet, or o get into a deadlock.

26 TUNALI Computer Networks 1 26 A One-Bit Sliding Window Protocol Continued 

27 TUNALI Computer Networks 1 27 A One-Bit Sliding Window Protocol (ctd.)

28 TUNALI Computer Networks 1 28 Peculiar Scenarios for Protocol 4 If both sides simultaneously send an initial packet, half of the frames contain duplicates but there is no transmission error Same situation may happen with premature timeouts

29 TUNALI Computer Networks 1 29 A Protocol Using Go Back n In protocol 4, sender is required to wait for an ack before the next frame is transmitted If the propagation delay is high, this causes waist of bandwidth. The solution is to allow the sender to transmit more than one frame before receiving any ack. To maximize throughput, the sender is expected to send w frames to keep the line busy, called pipelining.

30 TUNALI Computer Networks 1 30 Example If Channel capacity: 50 kbps Round trip propagation delay: 500 msec Frame length: 1000 bit Then Frame transmission time is 20 msec t=0 frame sent, t=520 msec ack received Protocol 4 uses 20/520 of the bandwidth To fully utilize bandwidth, w=520/20=26

31 TUNALI Computer Networks 1 31 Pipelining Receiver Policies Question What happens to the frames received after receiving an in correct frame? Answer Either discard all the frames proceeding the garbled one, (called go back n, receiver window size 1) Or accept those frames, but not forward the to the network layer until the garbled one is retransmitted correctly (called selective repeat, receiver window size greater than 1)

32 TUNALI Computer Networks 1 32 Receiver Policies

33 TUNALI Computer Networks 1 33 Sliding Window Protocol Using Go Back N Continued 

34 TUNALI Computer Networks 1 34 Sliding Window Protocol Using Go Back N Continued 

35 TUNALI Computer Networks 1 35 Sliding Window Protocol Using Go Back N Continued 

36 TUNALI Computer Networks 1 36 Sliding Window Protocol Using Go Back N

37 TUNALI Computer Networks 1 37 Protocol 5 Assumptions 1 Network layer may not always have a packet to send When it has a packet to send it causes network_layer_ready event Data link layer may not send frames as fast as the network layer wants enable_network_layer −Allow network layer to pass packets to data link layer disable_network_layer −Disallow network layer from passing packets to data link layer

38 TUNALI Computer Networks 1 38 Protocol 5 Assumptions 2 Sequence numbers range from 0 to MAX_SEQ When an acknowledgement comes in for frame n, frames n-1, n-2, and so on are also automatically acknowledged The window size is MAX_SEQ

39 TUNALI Computer Networks 1 39 Protocol 5 Assumptions 3 There are at most MAX_SEQ many frames outstanding at any instant If it were MAX_SEQ+1, then the protocol fails with the following scenario −The sender sends frames 0 to MAX_SEQ −It receives ack for MAX_SEQ −The sender sends another batch of frames from 0 to MAX_SEQ −All of the last batch is lost −The receiver sends ack for the last correctly received frame which is MAX_SEQ −The sender will think that all the frames of the last batch are correctly received and the protocol will fail

40 TUNALI Computer Networks 1 40 Multiple timer management

41 TUNALI Computer Networks 1 41 A Protocol Using Selective Repeat Protocol 5 has poor performance if the error rate of the channel is high An alternative receiver strategy is to accept frames proceeding a garbled one Frame sequence numbers start from 0 and grow to some predefined maximum MAX_SEQ The receiver window is always fixed and has a buffer reserved for each frame number in its window

42 TUNALI Computer Networks 1 42 A Sliding Window Protocol Using Selective Repeat Continued 

43 TUNALI Computer Networks 1 43 Continued  A Sliding Window Protocol Using Selective Repeat (2)

44 TUNALI Computer Networks 1 44 A Sliding Window Protocol Using Selective Repeat (3) Continued 

45 TUNALI Computer Networks 1 45 A Sliding Window Protocol Using Selective Repeat (4)

46 TUNALI Computer Networks 1 46 Protocol 6 Mechanisms 1 Function between Checks if the arriving frame sequence number falls within the window The window size is (MAX_SEQ+1)/2

47 TUNALI Computer Networks 1 47 Protocol 6 Mechanisms 2 The following scenario shows that the protocol fails when window size is MAX_SEQ The sender transmits frames 0 to MAX_SEQ-1 At the receiver, all frames are received correctly The receiver sends MAX_SEQ acks to sender and slides the window to MAX_SEQ-MAX_SEQ-2 All the acks are lost Sender times out and retransmits all the MAX_SEQ frames The receiver accepts frames 0 to MAX_SEQ-2 as new frames and the protocol fails

48 TUNALI Computer Networks 1 48 Failure Scenario

49 TUNALI Computer Networks 1 49 Protocol 6 Mechanisms 3 The number buffers needed is the size of the window There is a timer associated with each buffer Protocol 5 assumes that there is always reverse traffic to piggyback acks and it blocks if there is no reverse traffic Protocol 6 implements start_ack_timer When a data frame arrives, a timer is started If no data frame to send back, timer runs off and a special ack frame is sent

50 TUNALI Computer Networks 1 50 Protocol 6 Mechanisms 4 If the receiver suspects that a frame is garbled or lost, it sends a NAK frame to the sender requesting retransmission To prevent duplicate NAKs, variable no_nak is used. If the standard deviation of ack interval is small, NAK is not that useful Else, NAKs speedup the communication considerably

51 Example Data Link Protocols CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Packet over SONET » PPP (Point-to-Point Protocol) » ADSL (Asymmetric Digital Subscriber Loop) »

52 Packet over SONET CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Packet over SONET is the method used to carry IP packets over SONET optical fiber links Uses PPP (Point-to-Point Protocol) for framing Protocol stacks PPP frames may be split over SONET payloads

53 PPP (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 PPP (Point-to-Point Protocol) is a general method for delivering packets across links Framing uses a flag (0x7E) and byte stuffing “Unnumbered mode” (connectionless unacknow- ledged service) is used to carry IP packets Errors are detected with a checksum IP packet0x21 for IPv4

54 PPP (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 A link control protocol brings the PPP link up/down State machine for link control

55 ADSL (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Widely used for broadband Internet over local loops ADSL runs from modem (customer) to DSLAM (ISP) IP packets are sent over PPP and AAL5/ATM (over)

56 ADSL (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 PPP data is sent in AAL5 frames over ATM cells: ATM is a link layer that uses short, fixed-size cells (53 bytes); each cell has a virtual circuit identifier AAL5 is a format to send packets over ATM PPP frame is converted to a AAL5 frame (PPPoA) AAL5 frame is divided into 48 byte pieces, each of which goes into one ATM cell with 5 header bytes

57 TUNALI Computer Networks 1 57 Required Reading Tanenbaum Sections 3.4 3.5 3.6

58 TUNALI Computer Networks 1 58 Homework 2 Chapter 3 21 (23) 27 (30) 29 (32) 30 (34)

59 End Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011


Download ppt "The Data Link Layer 2 Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error."

Similar presentations


Ads by Google