You are on page 1of 11

Introduction to Computer

Networks and Telecommunications

Carnegie Mellon University


The Practical Software Engineering Series

Packet, Frames, and Error Detection

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 1

Objectives

† Understand why packets are the fundamental building block


of messages

† Be able to distinguish between a packet and a frame

† Understand the advantages and disadvantages of:

„ Parity Bits

„ Checksums

„ Cyclic Redundancy Checks

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 2


TDM and Packets

† Initially, computers could send arbitrarily long messages

† These messages would block other computers

† Now, each computer breaks up a message into packets

† Each computer takes a turn sending a packet

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 3

Example

† Computer A talks to computer D


† Computer B talks to computer C
† Computer A sends a 5 megabyte file at
a transfer rate of 56,000 bits/second

How long will it take to send the file?

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 4


Answer

† 5 Megabytes = 41,943,040 bits

† 41,943,040/56,000 = 749 seconds

† 749/60 = 12.4 minutes

† Packets containing 8,000 bits of data on a network that


transfer data at 56K bits/sec wait only .143 seconds before
transmitting

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 5

Recall: Packets and Frames

† A packet is a small block of data

† Packets make it easier for a sender and receiver to


determine where an error occurs

† Packets enable computers to share network resources

† Packets are general blocks of data

† A frame is a packet used with a specific type of network

† Remember – senders can wait arbitrarily long intervals


between characters

† How does a receiver know when the block has been sent?

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 6


Packets and TDM

† Dividing data into small packets ensures that all sources


receive prompt service

† Sources with small amounts of data will finish promptly

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 7

Frames

† Senders and receivers must agree on how the start


and end of a block is signaled

† soh and eot are ASCII characters used to denote the


beginning and end of a frame

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 8


Advantages/Disadvantages

† Disadvantage

„ Overhead – Each frame has a start and a stop character,


which may be wasted if two frames are sent one immediately
after the other

† Advantage

„ Error detection is easier

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 9

Error Detection

Sending Computer Crashes Here

soh Block of Data eot

Receiving Computer Crashes Here

soh Block of Data eot

Receiving Computer Crashes Here

soh Block of Data eot

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 10


Byte Stuffing

† Byte Stuffing – Changing the original data block


to ensure that eot and soh are not accidently
mistaken for legitimate characters within the data
block

† If eot and soh legitimately appear in the data


block, then the receiver will think it has seen the
end/start of a frame

† Byte stuffing uses a third character to mark


occurrences of special characters in the data

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 11

Byte Stuffing Example

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 12


Byte Stuffing Illustration

(a) is an example of data

(b) is a frame constructed with byte stuffing

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 13

Transmission Errors

† Small changes in the electrical signal can cause


the receiver to misinterpret one or more bits

† Interference on a idle circuit can cause a


receiver to think that the sender is sending
something

† Transmission errors is the problem of lost,


changed, or spuriously appearing bits

How does the receiver know that there were no errors?

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 14


Error Detection

† Parity bits are extra bits at the end of a character indicating


whether the number of 1 bits in the character are odd or
even

† Check sums treat the data as if it was a sequence of binary


integers and computes their sum

† Cyclic redundancy checks (CRC) uses simple hardware


components to analyze the data

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 15

Parity Bit Error Detection

† Even Parity Bit Error Detection – The number of ‘1’ bits


must be even

„ 01100101

„ 01001000

† Odd Parity Bit Error Detection – The number of ‘1’ bits must
be odd

„ 01100100

„ 01001001

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 16


Parity Checks
† Advantages

„ Simple

„ Fast

† Disadvantages

„ Does not work well when more than 1 bit is changed

„ A transmission error changed 2 bits: There are three possibilities

† 00 -> 11 then parity is maintained

† 11 -> 00 then parity is maintained

† 01,10 -> 10, or 01 then parity is maintained

Parity cannot determine a transmission error when


an even number of bits are changed

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 17

Checksums

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 18


Checksums cont’d

† Advantages

„ Size of checksum result is small (low overhead)

„ Ease of computation

† Disadvantage

„ Won’t detect all errors

A Checksum Failure

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 19

Cyclic Redundancy Checks

Hardware calculates CRC

Exclusive OR unit

Shift Register

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 20


Hardware for CRC

16 bit CRC Computational Unit

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 21

Summary

† Packets make it easier for a sender and receiver to


determine where an error occurs

† Packets are general blocks of data

† A frame is a packet used with a specific type of network

† Parity bits are extra bits at the end of a character indicating


whether the number of 1 bits in the character are odd or
even

† Check sums treat the data as if it was a sequence of binary


integers and computes their sum

† Cyclic redundancy checks (CRC) uses simple hardware


components to analyze the data

Jun 2008 © 2008, Shawn A. Butler, Ph.D. 22

You might also like