21
Direct Link Networks (I) Computer Networking Lecture 02 HKU SPACE Community College January 30, 2012 HKU SPACE CC CN Lecture 02 1/21

Direct Link Networks (I)

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Direct Link Networks (I)

Direct Link Networks (I)

Computer Networking Lecture 02

HKU SPACE Community College

January 30, 2012

HKU SPACE CC CN Lecture 02 1/21

Page 2: Direct Link Networks (I)

Outline

Network Building Blocks

Encoding

Framing

Error DetectionChecksumParity checkCRC

HKU SPACE CC CN Lecture 02 2/21

Page 3: Direct Link Networks (I)

Network Building Blocks

Network nodes

Switches and routers (highly specialized hardware)

Hosts (general-purpose computers)

Figure: Network workstation architecture example.

HKU SPACE CC CN Lecture 02 3/21

Page 4: Direct Link Networks (I)

Networking Building Blocks (Cont’d)

Network adapter and device driver

Almost all the networking functionality described in thischapter, except ARQ schemes (reliable retransmissionscheme), is implemented in the network adapter.The device driver interfaces between the network adapter andthe OS.

Unparalleled performance improvements of memory latencyand processor speed.

However, a network host runs at memory speed, not processorspeed.

HKU SPACE CC CN Lecture 02 4/21

Page 5: Direct Link Networks (I)

Networking Building Blocks (Cont’d)

A network link is a physical medium carrying signals in theform of electromagnetic waves.

A packet may go through different types of network link, andthe slowest link determines the end-to-end throughput.

Different types of links: cables, leased lines, last-mile links,wireless links.

Figure: Network links.

HKU SPACE CC CN Lecture 02 5/21

Page 6: Direct Link Networks (I)

Encoding

In a direct link connection, how does a receiver know what isreceived? 0 or 1?

Encoding here solves how to effectively and efficientlyrepresent 0 and 1 through electronic signals.

Figure: Signals travel between signaling components; bits flowbetween adapters.

HKU SPACE CC CN Lecture 02 6/21

Page 7: Direct Link Networks (I)

Encoding (Cont’d)

For discrete values 0s and 1s, two different states are enough.

Some encoding methods: NRZ, NRZI, Manchester, and4B/5B:

Figure: Different encoding strategies.

HKU SPACE CC CN Lecture 02 7/21

Page 8: Direct Link Networks (I)

Encoding (Cont’d)

Non-return to zero (NRZ)

0: a low signal; 1: a high signalHowever, in this scheme, consecutive 0s or 1s may producebaseline wander problem and clock recovery problem.

Non-return to zero inverted (NRZI) (an improved method)

1: making a transition from the current signal;0: staying at the current signal.Consecutive 0s problem remains.

Manchester encoding

0: low-to-high transition; 1: high-to-low transition (the resultof exclusive-OR of the NRZ-encoded data with the clock).Advantage: provide enough signal transitions for bitsynchronization.Disadvantage: double the rate of signal transitions.

HKU SPACE CC CN Lecture 02 8/21

Page 9: Direct Link Networks (I)

Encoding (Cont’d)

4B/5B encoding:Convert four bit into five bit such that consecutive 0s or 1s willbe broken up.Each code must have no more than one leading 0 and no morethan two trailing 0s, e.g., 00110 and 01000 are not used.The resulting 5-bits are transmitted using the NRZI encoding.

Figure: 4B/5B encoding.HKU SPACE CC CN Lecture 02 9/21

Page 10: Direct Link Networks (I)

Framing

How does a receiver know what is the meaning of a bits flow?

Framing defines the boundaries of a series of 0s and 1s, andmakes it become meaningful. (Actually it is a protocol whichdefines the boundaries and meaning of a frame.)

Figure: Bits flow between adapters, frames between hosts.

HKU SPACE CC CN Lecture 02 10/21

Page 11: Direct Link Networks (I)

Framing (Cont’d)

Byte-oriented protocols (e.g. PPP)

Data unit in terms of bytes (ASCII, EBCDIC)Sentinel approach vs. byte counting approach

Bit-oriented protocols (e.g. HDLC)

Sentinel approach

Clock-based framing (SONET)

HKU SPACE CC CN Lecture 02 11/21

Page 12: Direct Link Networks (I)

Framing (Cont’d)

Sentinel approach to byte-oriented framing (PPP)

A special character 01111110 (0x7e) serves as a start-of-textcharacter (flag field).

Character stuffing: escape the special character in the data byperpending it with an escape character 0x7d.

0x7e escaped to 0x7d, 0x5e0x7d escaped to 0x7d, 0x5d

Figure: PPP frame format.

HKU SPACE CC CN Lecture 02 12/21

Page 13: Direct Link Networks (I)

Framing (Cont’d)

Byte-counting approach to byte-oriented framing

SYN character serves as a synchronization character.

The COUNT field specifies how many bytes are contained inthe frame.

Figure: DDCMP frame format.

HKU SPACE CC CN Lecture 02 13/21

Page 14: Direct Link Networks (I)

Framing (Cont’d)

Sentinel approach to bit-oriented framing: using bit sequence01111110 to indicate boundaries of a frame.

Bit stuffing is used if the sequence appears in the data.

Sender insert a 0 after 5 consecutive 1s, except fortransmitting the 01111110 sequence.

When five consecutive 1s are received, receiver checks:

if the next bit is 0, remove it because it must be a stuffed bit;if the next two bit is 10, end of the frame; otherwise there isan error.

HKU SPACE CC CN Lecture 02 14/21

Page 15: Direct Link Networks (I)

Error Detection

Transmission errors do occur, with different probabilities indifferent media.

There are two problems in the error control: error detectionand error correction. The main problem is in error detection:whether there is an error, and where is the error?

However, no error detection scheme can guarantee a 100%error-free transmission.

Common error detection methods are checksum, parity check,and cyclic redundancy check (CRC).

To detect error, redundant information must be provided.

Two approaches to correct errors: correct at the sender side(easy) or correct at the receiver side (difficult).

HKU SPACE CC CN Lecture 02 15/21

Page 16: Direct Link Networks (I)

Error Detection (Cont’d)

Checksum: Add up all the words that are transmitted andthen append the “sum” to the original frame.

If any transmitted data, including the checksum itself, iscorrupted, then the results will not match.

Advantages:

Use a relatively small number of bits.Easy to implement in software.

Disadvantages: Not very strong, when comparing with CRC.

HKU SPACE CC CN Lecture 02 16/21

Page 17: Direct Link Networks (I)

Error Detection (Cont’d)

Parity check: using the parity property of the total number of1s in a packet; two kinds, i.e., odd and even; quitecost-effective.

Figure: A two-dimensional parity.

HKU SPACE CC CN Lecture 02 17/21

Page 18: Direct Link Networks (I)

Error Detection (Cont’d)

Cyclic redundancy check is a strong error detection method,which is based on polynomial division and arithmetic over thefield of integers mod 2.

When doing polynomial division, the remainder must be apolynomial with degree less than the divisor.

To perform arithmetic over the field of integers mod 2, wereplace the addition and subtraction with XOR operation, i.e.,ignore all the carries. In other words, addition and subtractionare equivalent in the field of integers mod 2.

In the following, we can convert a message into a polynomialby assuming all the coefficients of the polynomial are either 0or 1.

HKU SPACE CC CN Lecture 02 18/21

Page 19: Direct Link Networks (I)

Error Detection (Cont’d)

Define the following polynomials:

M(x) - A polynomial of degree n, (n+1 bits).F (x) - A polynomial of degree k−1, k≤n, (k bits).P(x) - The cascading of M(x) and F (x), i.e.,P(x) = M(x) · xk + F (x). It is of degree k+n, (k+n+1 bits).C (x) - A pre-defined CRC Polynomial of degree k, (k+1 bits).

Suppose now we want to send M(x), and assume that bothsides know about of C (x).

Base on M(x) and C (x), the sender is able to generates F (x),and then combine M(x) and F (x) to produce P(x). Thesender then sends P(x) to the receiver.

After received a P ′(x), P(x), the receiver performsP ′(x)/C (x). If the remainder is 0, then the receiver believesthat there is no error occurs during the transmission, andP ′(x) is the original P(x); otherwise, error is introducedduring the transmission and P ′(x) is not P(x).

HKU SPACE CC CN Lecture 02 19/21

Page 20: Direct Link Networks (I)

Error Detection (Cont’d)

So, how to find F (x) and how to determine C (x)?

First, assume there is a F (x) such thatP(x)=M(x)·xk +F (x) is divisible by C (x).

To find such a F (x), we first find out Q(x) and R(x) suchthat M(x)·xk =Q(x)·C (x)+R(x).

Then M(x)·xk−R(x)=Q(x)·C (x) is divisible by C (x).

Since we are doing arithmetic over the field of integers mod 2,M(x)·xk−R(x)=M(x)·xk +R(x). Therefore, we can letF (x)=R(x) and P(x)=M(x)·xk +R(x), thus finishing theconstruction of P(x).

The rest problem: how to determine C (x). Basically, there arerules for choosing C (x), and it involves more mathematics.

CRC can be efficiently implemented in hardware.

HKU SPACE CC CN Lecture 02 20/21

Page 21: Direct Link Networks (I)

Acknowledgments

Part of this slide set is referenced, prepared or/and extractedfrom the books: Computer Networks - A SystemsApproach and the book Routing in the Internet. Also,some images and information are sourced from the Internet.

This set of slides is for teaching purpose only.

HKU SPACE CC CN Lecture 02 21/21