Upcoming SlideShare
×

# Introduction to Computer Networks

334 views

Published on

Introduction to Computer Networks

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
334
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
0
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Introduction to Computer Networks

1. 1. 1CMPE 150- Introduction to Computer Networks CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks
2. 2. 2CMPE 150- Introduction to Computer Networks Announcements • TA office hours this week. – Instead of tomorrow, they will be held Friday 1-2pm at E2 315. • Book should be on reserve at S&E Library.
3. 3. 3CMPE 150- Introduction to Computer Networks Last Class • Layer 2 (Cont’d). – Mechanisms for error control: ACKs/NACKs, retransmissions, timers, etc. – Flow control. • Flow- versus congestion control. • Types of flow control. – Error detection and correction. • Trade-offs. • Hamming distance. • Error detection mechanisms and examples. • Error correction mechanisms and examples.
4. 4. 4CMPE 150- Introduction to Computer Networks Reading Assignment • Tanenbaum Chapter 3.
5. 5. 5CMPE 150- Introduction to Computer Networks Today • Error control (cont’d). • Error + flow control.
6. 6. 6CMPE 150- Introduction to Computer Networks Error Correction (Cont’d)
7. 7. 7CMPE 150- Introduction to Computer Networks Hamming Code • Bits in positions that are power of 2 are check bits. The rest are data bits. • Each check bit used in parity (even or odd) computation of collection of bits. – Example: check bit in position 11, checks for bits in positions, 11 = 1+2+8. Similarly, bit 11 is checked by bits 1, 2, and 8.
8. 8. 8CMPE 150- Introduction to Computer Networks Hamming Code: Example 7-bit . Hamming codes can only correct single errors. . But, to correct bursts of errors, send column by column.
9. 9. 9CMPE 150- Introduction to Computer Networks Error Detecting Codes • Typically used in reliable media. • Examples: parity bit, polynomial codes (a.k.a., CRC, or Cyclic redundancy Check).
10. 10. 10CMPE 150- Introduction to Computer Networks Polynomial Codes • Treat bit strings as representations of polynomials with coefficients 1’s and 0’s. • K-bit frame is coefficient list of polynomial with k terms (and degree k-1), from xk-1 to x0 . – Highest-order bit is coefficient of xk-1 , etc. – Example: 110001 represents x5 + x4 +x0 . • Generator polynomial G(x). – Agreed upon by sender and receiver.
11. 11. 11CMPE 150- Introduction to Computer Networks CRC • Checksum appended to frame being transmitted. – Resulting polynomial divisible by G(x). • When receiver gets checksummed frame, it divides it by G(x). – If remainder, then error!
12. 12. 12CMPE 150- Introduction to Computer Networks More on CRC •
13. 13. 13CMPE 150- Introduction to Computer Networks Cyclic Redunancy Check At Transmitter, with M = 1 1 1 0 1 1, compute 2r M= 1 1 1 0 1 1 0 0 0 with G = 1 1 0 1 T = 2r M + R [note G starts and ends with “1” ]  R = 1 1 1 Transmit T= 1 1 1 0 1 1 1 1 1
14. 14. 14CMPE 150- Introduction to Computer Networks Cyclic Redundancy Check At the Receiver, compute: Note remainder = 0  no errors detected
15. 15. 15CMPE 150- Introduction to Computer Networks CRC Performance • Errors go through undetected only if divisible by G(x) • With “suitably chosen” G(x) CRC code detects all single-bit errors. • And more…
16. 16. 16CMPE 150- Introduction to Computer Networks Flow + Error Control
17. 17. 17CMPE 150- Introduction to Computer Networks Flow + Error Control • How do Layer 2 protocols implement them? • What’s a frame? F FH TPayload . What’s F? . What’s in T? . What’s in H?
18. 18. 18CMPE 150- Introduction to Computer Networks Header and Trailer • Trailer typically has checksum. – How is it used/processed? • Header has: type, sequence number, and ack.
19. 19. 19CMPE 150- Introduction to Computer Networks 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.
20. 20. 20CMPE 150- Introduction to Computer Networks Stop-and-Wait: Pros and Cons • Very simple! • But, poor link utilization. – High data rates. – Long propagation delay.
21. 21. 21CMPE 150- Introduction to Computer Networks Noisy Channels From Stallings: Data and Computer Communications
22. 22. 22CMPE 150- Introduction to Computer Networks 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?
23. 23. 23CMPE 150- Introduction to Computer Networks 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, frame does not arrive. – At sender: ACK arrives correctly, ACK arrives damaged, ACK does not arrive.
24. 24. 24CMPE 150- Introduction to Computer Networks 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 (**)
25. 25. 25CMPE 150- Introduction to Computer Networks Simplex versus Duplex Transmission • Simplex: – Send data in one channel and control in another channel. • Duplex: – Send data and control on the same chanel.
26. 26. 26CMPE 150- Introduction to Computer Networks 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!
27. 27. 27CMPE 150- Introduction to Computer Networks Sliding Window Protocols • Window: number of “outstanding” frames at any given point in time. • Every ACK received, window slides…
28. 28. 28CMPE 150- Introduction to Computer Networks 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.