1 Chapter 7 Switching, Packets, Frames, Parity, Checksums, and CRCs.

Post on 18-Jan-2016

219 views 0 download

Tags:

Transcript of 1 Chapter 7 Switching, Packets, Frames, Parity, Checksums, and CRCs.

1

Chapter 7Chapter 7

Switching, Packets, Frames, Parity,

Checksums, and CRCs

2

Smallest piece of information

Smallest piece of information

When you send a message between two hosts, the smallest piece of information may be:

BitCharacter (e.g. RS232)

3

Switching Switching

When should this piece of information be sent?

As soon as it is available -> circuit switchingWhen the entire message is ready -> message

switchingAfter X number of bits/characters -> packet

switching

5

Connecting to the Network

The Problem

Connecting to the Network

The ProblemCannot afford individual network connection

per pair of computersReasons

Installing wires consumes time and moneyMaintaining wires consumes money (esp. long-

distance connections)

6

SolutionSolution

Network has Shared central coreMany attached stations

7

The Problem With SharingThe Problem With Sharing

Demand highSome applications have large transfersSome applications cannot waitNeed mechanism for fairness

8

Packet Switching PrinciplePacket Switching Principle

Solution for fairnessDivide data into small units called packetsAllow each station opportunity to send a packet

before any station sends anotherForm of time-division multiplexing

9

Illustration of Packet Switching

Illustration of Packet Switching

Acquire shared mediumSend one packetAllow other stations opportunity to send

before sending again

10

Packet DetailsPacket Details

Depend on underlying networkMinimum / maximum sizeFormat

Hardware packet called a frame

11

Example Frame Format Used with RS-232

Example Frame Format Used with RS-232

RS-232 is character-orientedSpecial characters

Start of header (soh)End of text (eot)

12

When Data Contains Special Characters

When Data Contains Special Characters

Translate to alternative formCalled byte stuffingExample

13

Illustration of Frame With Byte Stuffing

Illustration of Frame With Byte Stuffing

Stuffed frame longer than originalNecessary evil

14

Handling ErrorsHandling Errors

Data can be corrupted during transmissionBits lostBit values changed

Frame includes additional information to detect / correct error

Set by senderChecked by receiver

Statistical guarantee

15

Error Detection And Recovery TechniquesError Detection And Recovery Techniques

Parity bitOne additional bit per characterCan use

Even parityOdd parity

Cannot handle error that changes two bits

16

Error Detection And Recovery Techniques

(continued)

Error Detection And Recovery Techniques

(continued)Checksum

Treat data as sequence of integersCompute and send arithmetic sumHandles multiple bit errorsCannot handle all errors

17

Error Detection And Recovery Techniques

(continued)

Error Detection And Recovery Techniques

(continued)Cyclic Redundancy Check (CRC)

Mathematical function for dataMore complex to computeHandles more errors

18

Example Checksum Computation

Example Checksum Computation

Checksum computed over dataChecksum appended to frame

19

Illustration Of ErrorsA Checksum Fails to

Detect

Illustration Of ErrorsA Checksum Fails to

Detect

Second bit reversed in each itemChecksum is the same

20

Building Blocks For CRCBuilding Blocks For CRCExclusive or

Shift register

a shows status before shiftb shows status after shiftOutput same as top bit

21

Example Of CRC HardwareExample Of CRC Hardware

Computes 16-bit CRCRegisters initialized to zeroBits of message shifted inCRC found in registers

22

Example CRC ComputationExample CRC Computation

Input data is all 1 bitsCRC shown after 15, 16, and 17 bits shiftedFeedback introduces zeroes in CRC

23

Illustration of Frame Using CRC

Illustration of Frame Using CRC

CRC covers data only

24

SummarySummary

Packet technologyInvented to provide fair access in shared networkSender divides data into small packets

Hardware packets called framesCan use packet-switching with RS-232

Special characters delimit beginning and end of frameByte-stuffing needed when special characters appear in

data

25

Summary (continued)Summary (continued)

To detect data corruptionSender adds information to packetReceiver checks

TechniquesParity bitChecksumCyclic Redundancy Check (CRC)Provide statistical guarantees