1 / 27

# CMPE 150 Fall 2005 Lecture 13

CMPE 150 Fall 2005 Lecture 13. Introduction to Computer Networks . 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!

## CMPE 150 Fall 2005 Lecture 13

An Image/Link below is provided (as is) to download presentation Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

### Presentation Transcript

1. CMPE 150Fall 2005Lecture 13 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. Hamming Code (Revisited)

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. 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. Hamming Code: Example 1 Data: 1001000 using even parity (counting from right to left). 0 1 0 0 1 0 0 0 11 10 9 8 7 6 5 4 3 2 1 1: 1, 3, 5, 7, 9, 11

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

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? 11 10 9 8 7 6 5 4 3 2 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 0 1 1 1 Result: Bit in position 0 1 1 1 is wrong!

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) <= 2r. • Given m, then find r. • Example: If m = 7 (ASCII 7 code), minimum r is 4.

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

11. Flow + Error Control • Frame revisited. • Layer 2 encapsulation/decapsulation. • Flags. • Trailer: checksum. • Header: type, sequence number, ack.

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. Stop-and-Wait: Pros and Cons • Very simple! • But, poor link utilization. • High data rates. • Long propagation delay.

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. 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. 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 (**) ARQ Protocols

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. Can we do better? • 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. 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. 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. 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. 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. 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 … 2k -1k. • Transmission window shrinks each time frame is sent, and grows each time an ACK is received.

24. Example: 3-bit sequence number and window size 7 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 0 1 2 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 ACK 3 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 3 0 1 2 3 4 5 6 7 0 1 2 3 4 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 ACK 4 6 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. 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. Bandwidth-Delay Product • How large should the sender’s window be? • Function of how “fat” is the pipe? BW S R RTT W = BW*RTT/data size

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. Go Back N Receiver’s window size is large: buffers all frames until error recovered. Selective Repeat

More Related