Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks.

Similar presentations


Presentation on theme: "CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks."— Presentation transcript:

1 CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks

2 CMPE 150- Introduction to Computer Networks 2 Announcements Midterm postponed! –Instead of 10.28, it will be on 11.04! Lab next week: –Discussion sessions on protocol pseudo-code (from Tanenbaum Chapter 3). –Also, checksum calculation practice! Homework 2 due on Monday, 10.24.

3 CMPE 150- Introduction to Computer Networks 3 Hamming Code (Revisited)

4 CMPE 150- Introduction to Computer Networks 4 Hamming Code Check bits in power-of-two positions. Each check bit verifies a set of data bits. A data bit is checked by multiple check bits.

5 CMPE 150- Introduction to Computer Networks 5 Hamming Code (Cont’d) Parity computations: –11: 1, 2, 8 - 6: 2, 4 –10: 2, 8 - 5: 1, 4 –9: 1, 8 - 3: 1, 2 –7: 1, 2, 4

6 CMPE 150- Introduction to Computer Networks 6 Hamming Code: Example 1 11 10 9 8 7 6 5 4 3 2 1 1 0 0 1 0 0 0 0 1: 1, 3, 5, 7, 9, 11 Data: 1001000 using even parity (counting from right to left).

7 CMPE 150- Introduction to Computer Networks 7 Hamming Code: Example 1 (Cont’d) 11 10 9 8 7 6 5 4 3 2 1 1: 1, 3, 5, 7, 9, 11 Data: 1001101 using even parity (counting from right to left). 11 10 9 8 7 6 5 4 3 2 1 2: 3, 6, 7, 10, 11 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1

8 CMPE 150- Introduction to Computer Networks 8 Hamming Code: Example 2 What if instead of 1 0 0 1 1 1 0 0 10 1, receiver gets 1 0 0 1 0 1 0 0 1 0 1?. Receiver takes frame received and re-computes check bits.. 1, 3, 5, 7, 9, 11: 1, 1, 0, 0, 1 => 1. 2, 3, 6, 7, 10, 11: 0, 1, 1, 0, 0, 1 => 1. 4, 5, 6, 7 : 0, 0, 1, 0 => 1. 8, 9, 10, 11: 1, 0, 0, 1 => 0 11 10 9 8 7 6 5 4 3 2 1 0 1 1 1 Result: Bit in position 0 1 1 1 is wrong!

9 CMPE 150- Introduction to Computer Networks 9 How much code redundancy? How many check bits needed, i.e., given m data bits, how many more bits (r) are needed to allow all single-bit errors to be corrected? –Resulting frame is m + r. –(m+r+1) <= 2 r. –Given m, then find r. –Example: If m = 7 (ASCII 7 code), minimum r is 4.

10 CMPE 150- Introduction to Computer Networks 10 Hamming Code: Example 7-bit. Hamming codes can only correct single errors.. But, to correct bursts of errors, send column by column.

11 CMPE 150- Introduction to Computer Networks 11 Flow + Error Control Frame revisited. –Layer 2 encapsulation/decapsulation. –Flags. –Trailer: checksum. –Header: type, sequence number, ack.

12 CMPE 150- Introduction to Computer Networks 12 Stop-and-Wait Simplest form of flow control. How does it work? (assume error-free channel) –(1) Send 1 frame; –(2) Wait for ACK. –(3) Go to 1.

13 CMPE 150- Introduction to Computer Networks 13 Stop-and-Wait: Pros and Cons Very simple! But, poor link utilization. –High data rates. –Long propagation delay.

14 CMPE 150- Introduction to Computer Networks 14 Stop-and-Wait in Noisy Channels Need timers, retransmissions, and duplicate detection. Use sequence numbers. –Why? –Distinguish frames. –How large (e.g., in number of bits) are sequence numbers?

15 CMPE 150- Introduction to Computer Networks 15 ARQ Protocols Automatic Repeat Request. –Protocols that wait for ACK before sending more data. ACKs now are used for flow AND error control. What can happen? –At receiver: frame arrives correctly, frame arrives damaged, or frame does not arrive. –At sender: ACK arrives correctly, ACK arrives damaged, or ACK does not arrive.

16 CMPE 150- Introduction to Computer Networks 16 ARQ Protocols Sender: –Send frame 0. –Start timer. –If ACK 0, arrives, send frame 1. –If timeout, re-send frame 0. Receiver: –**Waits for frame. –If frame arrives, check if correct sequence number. –Then send ACK for that frame. –Go to (**)

17 CMPE 150- Introduction to Computer Networks 17 Simplex versus Duplex Transmission Simplex: –Send data in one channel and control in another channel. Duplex: –Send data and control on the same chanel.

18 CMPE 150- Introduction to Computer Networks 18 Can we do better? –Piggybacking. –Bi-directional transmission. –Wait for data packet and use that to piggyback the ACK. –Use ACK field: only a few additional bits in the header. But, how long should Layer 2 wait to send an ACK? –ACK timers!

19 CMPE 150- Introduction to Computer Networks 19 Sliding Window Protocols Window: number of “outstanding” frames at any given point in time. –So what’s the window size of Stop and Wait? Every ACK received, window slides.

20 CMPE 150- Introduction to Computer Networks 20 Sliding Window: Example A sliding window of size 1, with a 3-bit sequence number.(a) Initially; (b) After the first frame has been sent; (c) After the first frame has been received;(d) After the first acknowledgement has been received.

21 CMPE 150- Introduction to Computer Networks 21 Sliding Window: Basics Allows multiple frames to be in transit at the same time. Receiver allocates buffer space for n frames. Transmitter is allowed to send n (window size) frames without receiving ACK. Frame sequence number: labels frames.

22 CMPE 150- Introduction to Computer Networks 22 Sliding Window: Receiver Receiver ack’s frame by including sequence number of next expected frame. –Cumulative ACK: ack’s multiple frames. Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack’s receipt of 2, 3, and 4.

23 CMPE 150- Introduction to Computer Networks 23 More Sliding Window … Sender maintains sequence numbers it’s allowed to send; receiver maintains sequence number it can receive. Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 … 2 k -1 k. Transmission window shrinks each time frame is sent, and grows each time an ACK is received.

24 CMPE 150- Introduction to Computer Networks 24 Example: 3-bit sequence number and window size 7 0 1 2 0 1 2 3 4 5 6 7 0 1 2 3 4 ACK 3 0 1 2 3 4 5 6 7 0 1 2 3 4 3 4 5 6 ACK 4 0 1 2 3 4 5 6 7 0 1 2 3 4 A (Sender) B (Receiver) 0 1 2 3 4 5 6 7 0 1 2 3 4… 0 1 2 3 4 5 6 7 0 1 2 3 4

25 CMPE 150- Introduction to Computer Networks 25 One-Bit Sliding Window Protocol Two scenarios: (a) Normal case. (b) Abnormal case. Notation is (seq, ack, packet number). An * indicates where a network layer accepts packet. ACK indicates last sequence number received.

26 CMPE 150- Introduction to Computer Networks 26 Bandwidth-Delay Product How large should the sender’s window be? Function of how “fat” is the pipe? S R RTT BW W = BW*RTT/data size

27 CMPE 150- Introduction to Computer Networks 27 Pipelining Pipelining and error recovery. Effect on error when (a) Receiver’s window size is 1. (b) Receiver’s window size is large. Receiver’s window size is 1: discard frames after error with no ACK. Receiver’s window size is large: buffers all frames until error recovered. Selective Repeat Go Back N


Download ppt "CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks."

Similar presentations


Ads by Google