Download presentation

Presentation is loading. Please wait.

Published byDarby Mallen Modified about 1 year ago

2
COS 461 Fall 1997 COS 461: Networks and Distributed Computing u Prof. Ed Felten –felten@cs.princeton.edu u http://www.cs.princeton.edu/courses/cs461 u requirements –programs (in Java) –course project –midterm, final exams u now … on to business

3
COS 461 Fall 1997 Networking on a Shoestring u have two wires between points A and B u need to communicate (in both directions) –use one wire in each direction u how to do it?

4
COS 461 Fall 1997 Signaling u use voltage to represent ones and zeroes u two problems –no common ground level –timing

5
COS 461 Fall 1997 Ground u take average of recent voltage level –0 if much below average –1 if much above average

6
COS 461 Fall 1997 Timing u ideal: synchronized clocks u reality: can’t synchronize; clocks drift

7
COS 461 Fall 1997 Timing –strategy: run at approximately same speed »How close do we have to be? (Answer later.) –on seeing a transition, receiver re-adjusts its clock to the nearest half-tick –adjust clock forward or backward, whichever is shorter

8
COS 461 Fall 1997 Choosing Clock Speed u electrical effects flatten and spread waveform as it travels down wire u run as fast as possible without missing any transitions

9
COS 461 Fall 1997 Coping with Clock Drift u for correctness, receiver must not drift by more than half a cycle between transitions. u if max time between transitions is K cycles, clock speed must be within factor of 1+1/2K. u if no limit on K, no tolerance for drift

10
COS 461 Fall 1997 Forcing Transitions u idea: encode data before transmitting –code forces frequent transitions u example: Manchester encoding u tolerates 25% clock drift, but “wastes” half of bandwidth 01

11
COS 461 Fall 1997 Other Encodings u waste less bandwidth, but tolerate less drift –5/4 encoding in book –generally a good trade u other advantages of forcing transitions –keeps baseline voltage from drifting –detects broken wires

12
COS 461 Fall 1997 Framing u need to divide data stream into packets –variable length better than constant length »avoid wasting bandwidth »doesn’t add much complexity –two approaches »length field »end marker

13
COS 461 Fall 1997 Length Field Approach u first 16 bits of packet give the length u problem: error recovery

14
COS 461 Fall 1997 End-Marker Approach u special value marks end of packet –say it’s 11111111 u solves synchronization problems u but what if 11111111 occurs in data? u solution: bit stuffing –if sender sees seven 1’s in a row, insert a 0 –receiver deletes a 0 that follows seven 1’s

15
COS 461 Fall 1997 Error Control u real wires don’t always transmit data correctly –electrical glitches –physical stresses and damage u dealing with errors –detection –recovery

16
COS 461 Fall 1997 Error Detection u sender computes checksum, appends to packet u receiver verifies checksum u properties of a good checksum –always signal error if only a few bits corrupted –low probability of coincidental match if many bits corrupted –signals error if signal stuck on 0 or 1

17
COS 461 Fall 1997 Checksums in Practice u internet scheme –(roughly) take sum of 16-bit words in message –not very good, but fast to compute in software u CRC (cyclic redundancy code) –based on polynomial arithmetic in finite fields –implement in hardware with shift register and a few XOR gates

18
COS 461 Fall 1997 Error Correcting Codes u code message redundantly u detect/correct errors that affect a few bits u seldom used in practice –good at correcting a few bad bits, but errors tend to come in bunches –must be ready to recover from uncorrectable errors anyway –if errors are rare, better to handle other ways

19
COS 461 Fall 1997 Recovering from Errors u first try: ask sender to retransmit message –but: if wire breaks, sender thinks things are OK u second try: acknowledgements –receiver tells sender packet arrived safely –if no acknowledgement within a timeout period, sender retransmits packet

20
COS 461 Fall 1997 Retransmission Scenario 1 senderreceiver data ack

21
COS 461 Fall 1997 Retransmission Scenario 2 senderreceiver ack data

22
COS 461 Fall 1997 Retransmission Scenario 3 senderreceiver ack data ack data

23
COS 461 Fall 1997 Details u sequence number to identify packets –how big are sequence numbers? –one bit is enough (alternating bit protocol) u sender remembers packet until ack u packet type distinguishes ack from data –or piggyback ack on data packet u fancier schemes in another lecture

24
COS 461 Fall 1997 Review u speed limited by wire physics u approximately synchronized clocks u encoding to force frequent transitions u sentinel value marks end of packet –bit stuffing if sentinel occurs in data u checksum to detect errors u timeout and retransmission to recover from errors

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google