1 / 30

CSCI 4550/8556 Computer Networks

CSCI 4550/8556 Computer Networks. Comer, Chapter 7: Packets, Frames, And Error Detection. Shared communication media. Most network use shared media which interconnect all computers. However, only one source can successfully transmit data at a time. Packets.

patia
Download Presentation

CSCI 4550/8556 Computer Networks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 4550/8556Computer Networks Comer, Chapter 7: Packets, Frames, And Error Detection

  2. Shared communication media • Most network use shared media which interconnect all computers. • However, only one source can successfully transmit data at a time.

  3. Packets • Most networks divide into small blocks called packets for transmission. • Each packet is sent individually. • Such networks are called packet networks or packet switching networks.

  4. Motivation • Coordination - helps the transmitter and receiver determine which data have been received correctly and which have not. • Resource sharing - allows multiple computers to share network infrastructure. • Networks enforce fair use - each computer can only send one packet at a time.

  5. Dedicated network access • 5MB file transferred across network with 56Kbps capacity will require almost 12 minutes: • All other computers will be forced to wait 12 minutes before initiating other transfers.

  6. Packet switching access • If file is broken into packets, other computers must only wait until a packet (not entire file) has been sent. • From the previous example, suppose the file is broken into 1000 byte packets. • Each packet takes less than 0.2 seconds to transmit: • Other computer must only wait only 0.143 seconds before beginning to transmit. • If two files (from two computers) are each 5MB long, each now takes 24 minutes to transmit, but if the second file is only 10KB long, it will be transmitted in only 2.8 seconds, while the 5MB file still takes roughly 12 minutes.

  7. Time-division multiplexing • Dividing data into small packets allows time-division multiplexing . • Each packet leaves the source and is switched onto the shared communication channel through a multiplexor . • At the destination, the packet is switched through a demultiplexor to the destination.

  8. Packets and frames • Packet is a “generic” term that refers to a small block of data treated as a unit. • Each hardware technology uses different packet formats. • The term frameor hardware frame denotes a packet of a specific format on a specific hardware technology. • “Packet” is the term normally used for blocks inside a computer, and “frame” is normally used for blocks on the network media.

  9. Frame formats • There is a need to define a standard format for data to indicate the beginning and end of each frame. Otherwise, the receiver will have no way of distinguishing the end of one frame and the beginning of another. • Each packet and frame normally include a header and a trailer used to “frame” the data.

  10. Defining the framing standard • We can choose two unused data values for framing. • For example, if data is limited to printable ASCII characters, then we can use these characters for framing: • “start of header‘” (soh) – hexadecimal 01 • “end of text” (eot) – hexadecimal 03 • The sending computer sends soh first, then the data, and finally the eot character. • The receiving computer interprets and discards soh, stores data in the buffer and interprets and discards eot.

  11. Frame format

  12. Framing in practice • Framing causes extra overhead - soh and eot take time to transmit, but they carry no data. • But framing allows the detection of certain transmission problems: • A missing eot indicates the sending computer may have crashed. • A missing soh indicates the receiving computer missed the beginning of a message frame. • A bad frame is simply discarded by the receiver; other techniques allow recovery from this situation.

  13. Transmitting arbitrary data • Suppose the system can’t afford to reserve two special characters for framing. • For example, suppose we’re transmitting arbitrary 8-bit binary data. • soh and eot as part of the data would be incorrectly interpreted as framing data. • The sender and receiver must agree to encode special characters for unambiguous transmission.

  14. Data stuffing • Bit stuffing and byte stuffing are two techniques for inserting extra data to encode reserved bytes. • Byte stuffing translates each reserved byte into two unreserved bytes. • For example, we can use esc (hexadecimal 1B) as a prefix, followed by ‘x’ for soh, ‘y’ for eot and ‘z’ for esc:

  15. Byte stuffing • The sender translates each reserved byte into the appropriate pair of bytes that encode the reserved byte. • The receiver interprets these pairs of bytes and stores the encoded byte in buffer. • The data is still framed by an unencoded soh and eot.

  16. Transmission errors • External electromagnetic signals can cause incorrect delivery of data: • Data can be received incorrectly. • Data can be lost. • Unwanteddata can be generated. • Any of these problems are called transmission errors.

  17. Error detection and correction • Error detection - sending additional information so incorrect data can possibly be detected and rejected. • Error correction - sending additional information so incorrect data can possibly be corrected and accepted.

  18. Parity checking • Parity refers to the number of bits set to 1 in a data item: • Even parity - an even number of bits are 1 • Odd parity - an odd number of bits are 1 • A parity bit is an extra bit transmitted with a data item, chosen to give the resulting bits even or odd parity: • Even parity – data = 10010001 will have a parity bit = 1 • Odd parity – data = 10010111 will have a parity bit = 0

  19. Parity and error detection • Noise or other interference can introduce errors, and one or more of the bits in the data will be changed. As a result, the parity of resulting bits may be wrong. For example, if the communication system is using even parity: • Original data and parity: 10010001+1 (even parity) • Received data: 10110001+1 (odd parity – wrong!) • The transmitter and receiver must agree on which parity to use. • The receiver identifies any data with incorrect parity as an error.

  20. Limitations to parity checking • Parity can only detect errors that change an odd number of bits. For example: • Original data and parity: 10010001+1 (even parity) • Incorrect data: 10110011+1 (still even parity!) • Parity is usually used to catch one-bit errors. These one-bit errors are more common inside a computer system than on a communication channel.

  21. Alternative error detection schemes • Many alternative schemes exist, including those for • detecting multi-bit errors, and • correcting errors through redundant information. • Checksum and CRC are two widely used techniques.

  22. Checksums • A checksum is just the sum of the data in message, with the message treated as array of integers. • The message can be treated as an array of 8-, 16- or 32-bit integers. • Checksums frequently use one’s-complement arithmetic. • Example - 16-bit checksum with 1s complement arithmetic

  23. Implementing checksum computation • Checksum computation is easy to do – it uses only addition. • The fastest implementations of a 16-bit checksum use 32-bit arithmetic and add the carries in at the end of the computation. • The computation can also be made faster by unrolling the loop and other similar optimizations.

  24. Limitations to checksums • May not catch all errors

  25. Cyclic redundancy checks • To compute a cyclical redundancy check, we consider data in a message as the coefficients of a polynomial (e.g. 1010 = 1x3 + 0x2 + 1x1 + 0x0). • That polynomial resulting from the data is then divided by a standard, known polynomial. • The remainder of the division is then transmitted as the CRC . • CRC has good error detection properties. • CRC is easy to implement in hardware using a shift register and exclusive-or (xor) gates.

  26. Hardware components

  27. CRC hardware • The position of the xor gates and the size of the shift register are determined by the size of the standard polynomial. • The data bits of the message are fed into the shift register, one by one, as they are transmitted, and the shift register and xor gates operate in synchronization with the bit transmission. • At the end of the data transmission, the CRC is left in the shift register, ready to transmit.

  28. Error detection and frames • Error detection is typically done for each frame. • An error in a frame typically causes the receiver to discard the entire frame. [As noted earlier, we’ll later see techniques to handle retransmission.] • Example - CRC sent after end of frame computed on data in frame:

  29. Checking the CRC • At the receiving end, each of the received bits in a frame is sent into exactly the same shift register and xor gate hardware configuration as used by the sender. • After the entire message, with the suffixed CRC, has been sent through the shift register, the result will be zero if the message was received correctly (with a very high probability), or non-zero if there was an error. • For example, a 16-bit checksum catches all 1 and 2 bit errors, all errors with an odd number of bits, all burst errors of length 16 or less, 99.997 percent of all 17-bit error bursts, and 99.998 percent of 18-bit and longer error bursts.

  30. Summary • Computer networks divide data into packets for • Resource sharing • Fair allocation • Hardware frames are specific to a particular hardware network technology. • Each frame has a specific format that identifies the beginning and end of the frame. • Error detection and correction is used to identify and isolate transmission errors.

More Related