Direct Link Networks

102
Direct Link Networks Instructor: Rob Nash Readings: Chapter 2.1-2.4

description

Direct Link Networks. Instructor: Rob Nash Readings: Chapter 2.1-2.4. End host. End host. Application. Application. Presentation. Presentation. Session. Session. Transport. Transport. Network. Network. Network. Network. Data link. Data link. Data link. Data link. Physical. - PowerPoint PPT Presentation

Transcript of Direct Link Networks

Page 1: Direct Link Networks

Direct Link NetworksInstructor: Rob NashReadings: Chapter 2.1-2.4

Page 2: Direct Link Networks

Where We’ve Been…Application

Presentation

Session

Transport

End host

One or more nodeswithin the network

Network

Data link

Physical

Network

Data link

Physical

Network

Data link

Physical

Application

Presentation

Session

Transport

End host

Network

Data link

Physical

Page 3: Direct Link Networks

And the “I” Internet

TCP UDP

IP

Network

Application Layer

Page 4: Direct Link Networks

A Word on Layers“The protocol layer model makes a good

slave but a poor master”

But, consider implementing functionality at the lowest level in the stack where you can offer this service completely**Effectively, reliably

Page 5: Direct Link Networks

Point-to-PointThe simplest network possibleIssues here will focus on the lowest

protocols in our stackA shared medium provides the link

Thus, media access control will be a recurring issueConsider wireless & ethernet

All point to point concepts can be scaled up to internetworks simply by treating the gateway to two networks as the points/nodes in this example

Page 6: Direct Link Networks

Network MediaOptical FiberTwisted PairCategory 5Air

The first step: 2 nodes connected by some medium

Page 7: Direct Link Networks

Issues With P-2-P CommunicationHow to encode bits on the wire? (physical

layer)How to frame bits into packages of

meaningful data (framing)How to deal with corruption during

transmissionError Detection & Error Correction

Checksums, CRCs, Multi-dimensional parity, etc.

Link reliability in spite of an unreliable physical world

MAC – a shared medium needs to be arbitrated in some meaningful way

Page 8: Direct Link Networks

Types of Networks So Far…CSMA – WiFi - WiMAX – FDDI (token ring) –

Note that for these shared-access networks, reliability may or may not be implemented at the link level, so we’ll turn our attention to point-to-point networks for now.

Scarce Network Resources Are?

Page 9: Direct Link Networks

A Typical Desktop

CPU

Cache

RAM

NIC

I/O Bus

Note: A node’s memory performance and it’s network performance are quite related!

To Network

Page 10: Direct Link Networks

The NICWhat do Network Adapters do?They are the interface, the middleman for

the host and “the wild”A host interface for use with the OSA link interface for use with the physical link

Software on the host (device drivers called by OS) read from and write to the NIC’s CSR (status register)How we tell the card “what to do”, and learn

it’s current stateWhen data (a frame) arrives, we interrupt

the host

Page 11: Direct Link Networks

DMA vs PIO (Programmed IO)DMA allows the NIC to directly read and

write memory without CPU involvementHost gives the NIC an address, and the

adapter reads from or writes to it

PIO relies on the CPU to move dataA “tight loop” that implies a copy

But, it could be infeasable for the device driver, OS, and application to go to memory multiple times for each word of data in a packet.Esp if copying.

Page 12: Direct Link Networks

ParallelsThere are many parallels between moving a message to

and from memory and moving a message across a networkMemory speeds (and bus speeds) can provide a bottleneck

Key: We need to consider the memory bandwidth limitations (just like link level bandwidth limitations) as they affect our network performaceImplication: Network performing poorly? Not always the

network’s fault! (could be a congested server)Idea: try to coordinate OS & drivers & NIC to minimize

buffer copies

Page 13: Direct Link Networks

The Memory/Processor DivideWhile chips are still roughly following

Moore’s law, memory is only increasing at about 7% a year (wrt speed, not density)Implication: A network workstation will run at

memory speeds, and not processor speedsCritical Implications: How you manage your

code (and more specifically, your memory transfers) can have a heavy impact on network performance

Page 14: Direct Link Networks

Encoding Data (Physical Layer)We say that binary data is encoded in a signal, but

how?It’s a two-layer cake…

Modulation: varying the frequency, amplitude, phase, or any other physical characteristic of the signal in the medium for data encoding

Binary encoding: once we have some modulation system, this is the problem we’ll be focusing on

Hand-Waiving: as long as your sender can provide two (or more) distinguishable signals, we have our High/Low.So, we’ll focus on the Binary Encoding problem

Page 15: Direct Link Networks

Cables, Leased Lines, Last Mile LinksReturn to this with other slides

Page 16: Direct Link Networks

Fun Book Quote“For example, two buildings belonging to

the same organization but separated by a busy highway could communicate using lasers” (p79)

Page 17: Direct Link Networks

EncodingNRZNRZIManchester4B/5B

Page 18: Direct Link Networks

NRZ – Nonreturn to zeroGreat name!Lets map the data value 1 onto the high

signal, and the data value 0 onto the low signal.

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

Page 19: Direct Link Networks

Issues with NRZLong strings of 1s and 0s cause problems

hereClock recovery problems

Makes it difficult to know if we just observed one long 0, or actually three bits that were all 0 in a row

Baseline wanderMakes it difficult to calculate the threshold average

to determine a high or low signalWhat assumption/implication are we making?

Page 20: Direct Link Networks

Communication RequirementsThe sender’s and receiver's clocks need to

be precisely synchronized in order for the reciever to recover a frame accurately.But a long time without a transition will affect

the reciever’s ability to “tell time” – called clock drift

One approach is to try to artificially inflate the number of binary transitions by: encoding additional bits xoring data with a clockEmploying a wittier scheme than high == 1

and low == 0

Page 21: Direct Link Networks

NRZIThe sender makes a transition from the

current signal to encode a 1, and stays at the current signal to encode a 0.This makes for lots of transitions if we see

lots of 1sBut, what does this do for 0s?

Bits

NRZ

Clock

Manchester

NRZI

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

Page 22: Direct Link Networks

Manchester EncodingAside: What’s a Manchester Machine?ME: does an explicit job of merging the

clock signal with the data by XORing the data with the clockLots of transitions hereNote that this implies only a 50% efficiency!

Another way to say this bit rate is half the baud rateBaud rate being the rate at which the signal

changesLooking at the previous slide, note that the

Manchester encoding is transitioning twice as fast as NRZ, NRZI If the receiver can keep up with the doubled rate

of the manchester encoding scheme, then it could keep up with NRZ,NRZI transmitting at twice their current rate (in our example)

Page 23: Direct Link Networks

4B/5B EncodingBit StuffingEncode 4 bits of data in 5 bits, with rules about the

maximum number of 1s or 0s in a rowThe 5-bit codes are selected such that no 5-bit code has

more than one leading zero, and no more than two trailing 0s

01100 001111 11000

When sent back to back, this ensures no more than three consecutive 0sWhat about ones?

What is a good solution here?

Page 24: Direct Link Networks

4B/5B Stuffing with NRZIThe bit stuffing takes care of strings of 0s,

while NRZI takes care of strings of 180% Efficient

Page 25: Direct Link Networks

25

FramingBreak sequence of bits into a frameTypically implemented by a network

adaptor

Frame

BitsAdaptor Adaptor Node BNode A

Page 26: Direct Link Networks

Framing in the Data Link LayerSo we can transmit a bit or three – what to

do with them?Aggregating bits into larger structures –

FramingIf we’re using packet switched networks,

then we’re exchanging discreet packetsContrast this to the IPC streaming abstraction

we wish to provide

DL Goal: Trading frames of bits from one node’s memory to another across a link.What about errors?

Page 27: Direct Link Networks

Approaches

Header Body8 16 16 8

CRCBeginningsequence

Endingsequence

SY

N

Header Body

8 8 4214 168S

YN

Cla

ssCRCCount

Sentinel-based delineate frame with special pattern: 01111110 e.g., HDLC, SDLC, PPP

problem: ending sequence appears in the payload solution: bit stuffing

sender: insert 0 after five consecutive 1s receiver: delete 0 that follows five consecutive 1s

Counter-based include payload length in header e.g., DDCMP

Frame error

Frame error

problem: count field corrupted (frame error) solution:

Wait for the next beginning sequence Catch when CRC fails

Page 28: Direct Link Networks

PPP – Byte-Oriented ProtocolsOlder protocols used this, still in use todayCollect a frame as a collection of bytes (chars)

BISYNC by IBMDDCMP by DECPPP – recent and widely used, works in conjunction

with LCPThese are “link layer” protocols

Notice the previous frame formats include a CRC or Checksum – what is that?How does this affect link-level reliability?

Page 29: Direct Link Networks

Contrast with Bit-Level ProtocolsSynchronous Data Link Control by IBM

Standardized by the ISO as HDLC

Note that bit stuffing (or character stuffing) implies a variable length frame (if the payload contains the END sentinel, we need to insert a DLE,but this grows the size of our frame!)Thus, we’ll be considering networks with

variable length framesContrast this to SONET

Page 30: Direct Link Networks

Bit Stuffing (and Unstuffing)Used in bit-oriented protocols (HDLC)

High-Level Data Link Control (ISO version of SDLC from IBM)

Key: protect the sentinel by stuffing bits01111110Sender: anytime we see 5 consecutive 1s in the

payload, stuff a zero in the streamReceiver: if we see 5 consecutive ones, lookahead

If the next bit is a 0, it was stuffed (since the sentinel shouldn’t be here) so remove it.

If the next bit is a 1, lookahead (error or EOFrame) If we see a 0, this is the EOFrame If we see a 1, this is an error

See problem #5

Page 31: Direct Link Networks

SONET – Clock Based FramingWhat if nodes all agreed on a frame length

& a clock speed?Less worry about clock wander & less

complex without variable length framesSentinels do guard the boundaries of each frame,

however.SONET Frame quanta: 125microseconds STS-1: 810 bytes longSTS-3: 810x3 = 2430 bytes long

Page 32: Direct Link Networks

32

SONET (cont)Clock-based

each frame is 125us longe.g., SONET: Synchronous Optical NetworkSTS-n (STS-1 = 51.84 Mbps)

Overhead Payload

90 columns

9 rows

STS-1Hdr STS-1Hdr STS-1Hdr

STS-3cHdr

Interleaved every byte: keep 51Mbps for each STS-1

Page 33: Direct Link Networks

Error DetectionBasic Idea: Add redundant information to a frame

that can be used to determine if errors have been introducedAnd in some cases, we have enough information to

correct the errorDo make the distinction, however, between correction and

detection (and note that we’re concerned here with detection)

Parity bitsChecksums

Internet ChecksumCRCs

Page 34: Direct Link Networks

One-Dimensional ParitySeven bits encode data, last bit encodes a

“balance” bitEven parity = choose last bit to have an

even number of 1sOdd parity = choose last bit to have an odd

number of 1s

For Even parity, given the bit string “0101011X”, what should X be?

For Odd parity, given the bit string “1011001X” what should X be?

Page 35: Direct Link Networks

Multi-Dimensional Parity

0101001 11101001 01011110 10001110 10110100 11011111 01111011 0

Paritybits

Paritybyte

Data

Page 36: Direct Link Networks

Direct Link Networks Instructor: Rob NashReadings: Ch2.4-2.5 (2.6-2.7)Today:

CRCStop-and-waitSliding windowHomework Problems

Announcements:Schedule to be updated by thursday (off-by-one)New assignment out todayOur first exam is weeks away! (May 5th)

Exam review next thursday

Page 37: Direct Link Networks

Internet ChecksumView message as a sequence of 16-bit

integers; Convert each 16-bit integer into a ones-

complement arithmeticSum up each integerIncrement the result upon a carry

Page 38: Direct Link Networks

One’s Compliment-5 is ?-2 is?

Negate the “positive” version Add one on a carryIs zero positive or negative?

Page 39: Direct Link Networks

Code Exampleu_shortcksum(u_short *buf, int count){ register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { // carry occurred, so wrap around sum &= 0xFFFF; sum++; } } return ~(sum & 0xFFFF);}

Page 40: Direct Link Networks

Cyclic Redundancy CheckBased on polynomials and Finite FieldsMath may be daunting at first, but the

practice isn’t difficultCan be done quickly using shift registers and

XOR gates

First, some background on polynomial arithmetic

Page 41: Direct Link Networks

Algorithmic OverviewWe want to divide our message M(x) by a well known

key and produce the remainderThe choice of the key determines the errors it will protect

againstOnce we have the remainder, we can subtract this from

our original message A, which guarantees A % key == 0That is, our C(X) evenly divides our new message P(x)P(x) is M(x) plus the k redundant bits for the CRC

If the receiver sees that P(x) Mod C(x) == 0, we can discard the CRC bits and obtain the original M(x)Plus, be certain we avoided a large class of bit-level errors

Page 42: Direct Link Networks

Polynomial ArithmeticB(x) / C(x) is allowable, provided

degree(B(x)>=C(x))If == to, then of course, only one division is

performedThe remainder of B(x)/C(x) is obtained by

polynomial subtraction

To find the B(x) mod C(x), “subtract” C(x) from B(x) To subtract, simply XOR the two bit patterns

Page 43: Direct Link Networks

An ExampleLets do problem 18 in the textM(x) = 1100 1001

What poly does this represent?C(x) = x^3 + 1

What is this in binary representation?

Page 44: Direct Link Networks

The RemainderShift (multiply) our M(x) by k, where k is given by

the generator polynomial (in this case, k = 3)This is T(x)

Perform the “long division” using the poly subtraction technique(note: not really long division; long poly subtraction?)

Poly subtract the remainder from your (zero-extended) message, T(x) and send this messageNote that the message is really M(x) & CRC bits

Page 45: Direct Link Networks

Picking the Appropriate C(x)You pick this amongst a set of known polynomials that are

designed to catch specific types of bit-level errors

We can prove that the following types of errors can be detected by a C(x) with the stated properties:All single-bit errors, as long as x^k and x^0 are nonzeroAll double-bit errors, as long as C(x) has a factor with 3 or

more termsAny odd number of errors, as long as C(x) contains x + 1Any burst error for which burstLen < k

However, most burst errors larger than k can also be detectedSummary: the stronger the mathematical technique, the

stronger the detection and/or fewer redundand bitsSee p101. for a list of common CRCs

Page 46: Direct Link Networks

Reliability The ability to send and receive successfullyThe application developer’s perspective

might be:No lost packetsNo out of order packetsNo duplicate packetsNo corrupt packets (we just dealt with this :

LL strategies)

Usually, two strategies are used: ACKS and timeouts

Page 47: Direct Link Networks

ACKnowledgementsA small control frame belonging to a

protocol that is sent as a receipt of data transmissionControl here: all header and no payloadYou could also attach an ACK to a payload

packet (piggyback)

If the sender doesn’t see an ACK in a “reasonable” amount of time, what has happened?

Page 48: Direct Link Networks

Timeouts“The action of waiting a reasonable amount

of time.”

When we’ve run out of wait time!

The combination of ACK & timeout mechanisms: ARQAutomatic Repeat Request

Page 49: Direct Link Networks

CSS 43249

Acknowledgements & TimeoutsSender Receiver

Frame

ACK

Tim

eout

Tim

e

Sender Receiver

Frame

ACK

Tim

eout

Frame

ACKTim

eout

Sender Receiver

Frame

ACKTim

eout

Frame

ACKTim

eout

Sender Receiver

Frame

Tim

eout

Frame

ACKTim

eout

(a) (c)

(b) (d)

Receiver can’t distinguishif the 1st and 2nd frames are identical

Page 50: Direct Link Networks

Simple ARQ : Stop-and-WaitTransmit a frame; stop, and wait.

Advantages? Disadvantages?

See p.103

Page 51: Direct Link Networks

CSS 43251

Stop-and-WaitStop a transmission and wait for ack

to return or timeoutAdd 1-bit sequence number to detect

a duplication of the same frameProblem: Can’t utilize the link’s

capacityExample

1.5Mbps link x 45ms RTT = 67.5Kb (8KB)If the frame size is 1KB and the sender

waits for 45ms RTT1KB for 45ms RTT1/8th link utilization

Sender Receiver

Frame 0

Frame 1

Frame 0

Ack 0

Ack 0

Ack 1

Page 52: Direct Link Networks

Delay X Bandwidth ProductThe amount of data “in flight”The maximum amount of data that could

be sent without waiting for (the first) ACKKeeping the pipe full

With stop-and-wait, are we approaching this?What happens in s&w if the latency or

transmit time increases?And, why do we need the one-bit sequence

number?

Page 53: Direct Link Networks

More Complex ARQ: Sliding WindowAll frames will have a sequence number

(SeqNum)There exists an upper bound on the

number of outstanding frames, limited by the delay x bandwidth product But also affected by network resources

Sender Receiver

Time

……

Page 54: Direct Link Networks

Senders ResponsibilitiesSender maintains:

SWS (send window size)Upper bound on the number of unACked

(outstanding) frames the sender can transmitLAR (last ACK received)

A sequence numberLFS (last frame sent)

A sequence numberInvariant: LFS-LAR <= SWS

Page 55: Direct Link Networks

SenderInvariant: LFS-LAR <= SWSNote that sender must buffer up to SWS

frames, since if lost it will need to retransmit those frames.

When an ACK arrives, LAR =++LAR % TotalSeqNum

£ SWS

LAR LFS

… …

Page 56: Direct Link Networks

Receiver’s ResponsibilitiesRWS - receive window size (a count)LAF – largest acceptable frame (sequence

number)LFR – last frame received (sequence

number)

Invariant: LAF-LFR < RWS£ RWS

LFR LAF… …

Send a cumulativeAck

discard

Page 57: Direct Link Networks

Sender & Receiver Window Size The SWS is selected according to how many frames

we want outstanding on the link at a given timeUsually tuned to match the delay x bandwidth product

The RWS can be set to anythingAn RWS of 1 means the reciever will not buffer any

out-of-order framesRWS = SWS implies the receiver can buffer any of the

frames the sender transmitsRWS > SWS – does this ever make sense?

Page 58: Direct Link Networks

Finite Sequence NumbersConsider a SWS=RWS of 7The sender sends frames 0..6 successfullyAll ACKS from the receiver were lostThe receiver, however is waiting for frames

7,0,1…The sender times out and resends 0..6The receiver, waiting for 7,0,1,2,3,4,5,6

incorrectly interprets these as the next frames it was expectingIt was ambiguous as to which sequence

number iteration the resend was addressing – the first batch or the second?

Implicit in this : SWS < (MaxSeqNum + 1) / 2

Page 59: Direct Link Networks

SWS < (MaxSeqNum + 1) / 2This holds when SWS = RWS and frames are in order

For p2p links, ooo frames aren’t introduced, but we’ll return to this

Intuition: the sliding window alternates between the two halves of the sequence space (but slides rather than jumps)This is similar to our alternating sequence numbers in S&W

Said another way: MaxSeqNum + 1 < SWS/2So, if we know our desired SWS (due to the pipe product),

we can determine our MaxSeqNum (+1) as SWS * 2

Page 60: Direct Link Networks

Flow Control and Window SizesThe advertised window size is used for flow

control TCP uses a sliding window

The advertised window n is the number of bytes the receiver has space for

Or, you can send n bytes without an ACKWindow size is provided per packet and

controlled by the applicationAlter the socket buffer size to see this

Page 61: Direct Link Networks

UDP and Timer APIsThis Thursday, after we’ve read the next

assignment

Page 62: Direct Link Networks

Sliding Window ResponsibilitiesThis returns to the layering discussionWhat should the link layer concern itself

with?Does our SW algorithm really need to order

frames, or is this unnecessary (even redundant?) functionality at the link level.We’ll return to this once we’re higher up in the

protocol stackDoes our SW algorithm really need to provide

flow control?A feedback mechanism by which the receiver can

throttle the senderAccomplished by augmenting the SW protocol so it

includes a count of either frames (or bytes) it is willing to accept

Again, is this necessary at this level?

Page 63: Direct Link Networks

Silly Window Syndrome & NaglingImagine a heavily loaded server that

continues to tell senders to “back off” with the amount of data they are sendingThis means tuning the “bytecount” that the

server is willing to buffer

In the extreme, the server indicates a “silly” window size, such as 1 byte/charThis would correspond to a keystroke in a

telnet session, but look at the overhead!40 bytes for the header, 1 byte for the payloadTerrible overhead and inefficiency

Page 64: Direct Link Networks

Nagle’s AlgorithmBuffer small payloads into more reasonable

sizes, to balance overhead versus payloadTCP_NODELAY turns off “nagling”Otherwise, we’d need to issue flush()

commands per packetAnd, both nagling and flush() would affect

our timing dataSo our small payloads are sent, rather than

buffered into larger payloads that we didn’t intend to send

Page 65: Direct Link Networks

Introduction to EthernetThe most successful LAN technology in the

last few decadesXerox PARC (later DEC and Intel)

What didn’t they invent? Ethernet is in a class of CSMA/CD LAN

technologyCarrier Sense Multiple Access with Collision

DetectionCarrier Sense: we listen to the line, even when

sendingCollision Detection: if while sending, we receive, a

collision

Before Ethernet, there was AlohaDeveloped at the University of Hawaii to

facilitate communication across the Hawaiian islands

Page 66: Direct Link Networks

AlohaWhile the mediums differ (air, CAT5), the

dilemma remains the same: how to effectively share a medium amongst a competing set of nodesAnd, be fair (no starvation)And, be efficient

Page 67: Direct Link Networks

Today : Ethernets & RingsToday: 2.6-2.7Discuss the new homeworkNext Tuesday: 3.1-3.3See updated schedule!

Page 68: Direct Link Networks

Intro to EthernetStandardized as IEEE 802.3, which defines

many mediums over which Ethernet can function.Extended to include 100-Mbps (point-to-point,

not usually MA)Revised to include 1000-Mbps (point-to-point,

not MA)These extensions we’ll revisit when we cover

switching networksWe’re still considering multiple access media here, so

10-Mbps

Core idea in both Ethernet and Aloha: MACMAC: controlling when each node can transmit

Page 69: Direct Link Networks

A Token Ring PlugWhat if we simply passed around a Token,

and whoever has the token can currently utilize the link?

We’ll look at these more later, but see FDDI and RPR

Page 70: Direct Link Networks

Spanning an EthernetAn Ether segment is implemented on a coax cable <= 500m

Similar to cable used in the TV sectorCap on segment & repeater length implies a cap on one-way latency

(51.2 MuS)You connect to an Ethernet via taps, which must be 2.5m apart

Otherwise, collisions get trickier to detect

A transceiver (attached to the NIC) is directly attached to the tapBoth detects incoming signals and drives the line when idle

All of the Ethernet protocol is implemented in the adaptorMultiple Ethernet segments can be joined by a repeater

Similar to an amplifierNo more than 4 repeaters between any two hosts, so 2,500m limit

Page 71: Direct Link Networks

More Ethernet SpecsMax number of repeaters is 4 between any two hostsMaximally configured Ethernet has 1024 hostsTransmission method: Broadcast in both directions

Terminators on the end of a segment prevent message feedback

Physical Link Encoding Scheme: Manchester (why? See 46)

10Base5 – original coax, 50 ohms and 500m10Base2 – thin-net, 200m in length10BaseT – Twisted pair (Cat5) is limited to < 100m

Both 100 and 1000-Mbps Ethernets run over Cat5, same distance

Page 72: Direct Link Networks

Ethernet Specs ContinuedFrames must be at least 512 bits (64 bytes) to detect

collisions in a maximally configured ethernet14 bytes of header, 46 bytes of data, 4 bytes of CRC

See CRC problem

Why 512 bits?Why 2,500m?The farther apart two nodes are, the longer it takes for a

frame sent by one to reach the other, and during this time the network is vulnerable to a collisionSo we want to transmit data at least this long, so we know

for sure that a collision didn’t occur (or did)

Page 73: Direct Link Networks

The DEC-Intel-Xerox Ethernet Frame

Destaddr

64 48 32CRCPreamble Src

addr Type Body1648

The Preamble is an alternating clock signal useful for synchronizationWhy 48 bits per address, and what does this imply re: address space?802.3 substitutes a length field for the type (demux key for upper layers)

Page 74: Direct Link Networks

CSS 43274

The Collision Domain

A B

A B

A B

A B

500m x 5 = 2500m (with 4 repeaters)

A collision occurred

Time t

Time t + d(d = 25.6us)

Time t + 2d(2d = 51.2us)

Jam seq

10Mbps x 51.2us = 10 x 106 x 51.2 x 10-6 = 512bits = (64bytes)

Page 75: Direct Link Networks

Good News! Bad News!We did a linear (and not exponential

backoff)The linear version is simplerThe exponential version is simple too!

Once we’ve derived it

In fact, the formula is just 2n – 1 / 2(n+1)

Page 76: Direct Link Networks

Exponential Backoff SummaryCollision 1: {0,51.2} //Card: 2

Collision 2: {0,51.2,102.4,153.6} //Card:4Collision 3: {0,…,153.6,204.8, 256,

307.2} //Card:8

Summary: 2^n choices for collision n

Page 77: Direct Link Networks

Consider A and B’s CollisionsA,B Collide the first time, each choosing

from {0,51.2}

The number of combinations : 2 ^ (2n) = 4 (denom)

The number of winning combinations for A is:A:51.2, B:0 //only 1

The probability of A winning here is ¼=25%

Page 78: Direct Link Networks

The Second Collision…A,B Collide the second time, each choosing from

{0,51.2, 102.4, 154.6}

The number of combinations : 2 ^ ( 2n ) = 16(denom)

The number of winning combinations for A is:B:154.6, A chooses anything <154.6 (+3 options)B:102.4, A chooses anything < 102.4 (+2 options)B:51.2, A chooses anything < 51.2 (+1 option)

The probability of A winning here is 6/16= 37.5%

Page 79: Direct Link Networks

Collision Three…A,B Collide the third time, each choosing from {0,51.2,

102.4, 154.6, 205.8, 256, 307.2, 358.4}

The number of combinations : 2 ^ ( 2n) = 64(denom)The number of winning combinations for A is:

B:358.4, A chooses anything <B (+7 options)B:307.2, A chooses anything <B (+6 options)…B:154.6, A chooses anything <154.6 (+3 options)B:102.4, A chooses anything < 102.4 (+2 options)B:51.2, A chooses anything < 51.2 (+1 option)

The probability of A winning here is 28/64= 37.5%

Page 80: Direct Link Networks

Collision NThe denominator here is easy; its just the

number of combinations (that grow exponentially), given by:2 ^ ( 2n)

The numerator looks much like factorial, but instead uses addition in place of multiplicationIn general, the sum of the numbers from one

to x is Sum = x(x+1)/2

Page 81: Direct Link Networks

Sum = x*(x+1) / 2Our first sum looks like C=1, n=1, so numerator = 1

0 + 1

Our second sum looks like C=2, but we really want to sum up the numbers 3 + 2 + 1 = 62^2 – 1 = 4 – 1 = 3

And using the sum formula (3*4/2) = 6

Our third…C = 3, and we want to sum 7 + 6 + 5 + … = 282^3 – 1 = 8 – 1 = 7

Using the above sum formula (7*8/2)=28

Let x = 2^n – 1; the numerator then, using Sum = x* (x + 1) / 22^n – 1 * 2^n / 2This is our numerator

Page 82: Direct Link Networks

Putting it All TogetherDenominator: 2^n * 2^n (A and B’s options)Numerator (built from the summation formula)

( (2^n-1) * 2^n ) /2

The 2^n’s factor outAnd, move the factor of 2 to the denominator

Left with 2n – 1 / 2(n+1)

Collision 10 would be ?Collision 16 would be : 65536 – 1 / 65536 * 2 = .49999…Colafooo {25%,37.5%,43.75%, …, 49.999%}

Page 83: Direct Link Networks

Min and Max ValuesThe max frame size is 1,500 bytes – why?

The max size of an Ethernet is 2,500m – why?

The minimum frame size is 512 bits – why?

Page 84: Direct Link Networks

Min and Max ValuesThe max frame size is 1,500 bytes – why?

This puts an upper bound on the length of any one node’s transmission; other nodes can compete for the shared medium before too long, preventing starvation

The max size of an Ethernet is 2,500m – why?This puts an upper bound on the RTT time, and

defines the size of the minimum frame, since we must transmit long enough to be able to determine either (1) we collided or (2) no collision happened.

The minimum frame size is 512 bits – why?Considering the maximally configured ethernet, the

latency (26.1 MuS) times bandwidth (10-Mbps) times 2 for the RTT.

Page 85: Direct Link Networks

Ethernet Summary & 43, 44(a,b)Broadcast, Multicast, UnicastPhysical layer is bit orientedEthernet Segments: 500m or less (for 10Base5)Max Number of Repeaters Between Hosts: 4Max Total Network Length: 2,500mMax Hosts: 1024Max Frame: 1500 BytesMin Frame: 512 bits (64 Bytes)Globally unique MAC addresses Configurations: Star, Point-to-Point1-Persistent with Exponential BackoffWorks best under lightly loaded conditions

Page 86: Direct Link Networks

Ethernet HistoricallyA practical and inexpensive technology solution for both

the physical layer and link layer.When we discuss switching, we’ll leverage the Ethernet

once again

What does Ethernet not do?Flow control (usually an End-to-End responsibility)

A dominant networking technology that works best under lightly loaded conditions (<30% is heavy utilization)Under heavy load, the efficiency degrades as we thrash

under too many collisions

Page 87: Direct Link Networks

Token Ring Quotes For Reapers“Obtain a better lap time to qualify!” - ?

“I am the monitor of this ring installation “ - ?

“Is it secret? Is it safe?” - ?

Page 88: Direct Link Networks

Token Holding Time (THT) How long we expect each station to hold

the token (ie, transmit) for.This is effectively a lap calculation involving

the number of hosts, as in:NumStations * THT + LapLatency

Page 89: Direct Link Networks

Token Rings Elect MonitorsThese monitors are responsible for the

health of the networkMissing tokens, orphaned frames,

corrupted frames

Page 90: Direct Link Networks

Gandalf Wonders About RPRSure, it’s recent.And it uses early release.Yes, dual rings do sound nice.(esp. for a ring break)And, receiver removes framesRuns over Ethernet, SONETBut no token? (see buffer insertion)

Page 91: Direct Link Networks

Reliability: A and C Bits The sender sets both to 0The receiver upon seeing a frame sets the

A bit to 0The receiver sets the C bit once the frame

is buffered

If the sender sees both 1s, drain the frame (success)

If the sender sees a one in the A but not in C, then the receiver could be congested (retry later?)

If the sender sees both A and C as 0, then this message has been around the ring and found no reciever!

Page 92: Direct Link Networks

Rings & Ethernet SimilaritiesBoth use a type of Manchester encodingBoth offer demux keys to for higher-level

protocolsBoth use a 32-bit CRCBoth have every node see every frame

Except for RPRMSAUs and Ethernet Hubs are easy to

attach to Both offer reliable delivery

Page 93: Direct Link Networks

Differences?A tokenA monitorWhat happens during a node failureToken rings offer (a 3-bit) QoS via a strict

priorityToken Rings do better under heavier loadEthernets perform the best under lightly

loaded conditionsMost nodes on the network don’t have data

to send all at the same time, and Ethernet relies on this

A ring versus connecting line segments

Page 94: Direct Link Networks

Intro to Homework #2Due: Before our Midterm (5th of May)Working with UDP and TimersSend some UDP packets and hope they

arrive (case 1) Implement the Stop-And-Wait algorithmImplement the Sliding Window algorithmCompare the performance of the sliding

window algorithm through experimentation using point-to-point networks (100,1Gbps)Varying the SWSConstant packet size (1500 total, 1460 for

payload)

Page 95: Direct Link Networks

A Bit on UDPUDP is connectionless protocol for sending

unreliable datagramsBuilt on IPMuch faster than TCP as there is far less

overheadUDPSocket sends Ethernet-fitted frames

1460 Bytes for us, not including header information

This will avoid further fragmentation at the link level

Page 96: Direct Link Networks

Where to Start: HW2.cppThis program makes a UDP socket for you, allocates

your message size, and offers the user 3 optionsCase 1: Unreliable Delivery

Try to send 20,000 packets – good luck, and may hang.Case 2: Stop-and-Wait

Reliable and slowCase 3: Sliding Window (1 to n)

Observe the improvements as we pipeline our messages

You’ll write the functionality for above in udp.cpp, invoked from HW2.cppNote the same approach: one binary for both client &

server

Page 97: Direct Link Networks

udp.cpp (& Case 1 TODOs)void clientUnreliable( UdpSocket &sock, const int

max, int message[] );Sends 20K messages using the sock object

void serverUnreliable( UdpSocket &sock, const int max, int message[] );Receives 20K messages with no ACKS being sent

This could lock up – how?

Page 98: Direct Link Networks

udp.cpp (& Case 2 TODOs)int clientStopWait( UdpSocket &sock, const int

max, int message[] );Sends 20K messages while receiving 20K ACKsSet a timer upon sending a message; if timeout,

resend.1500uSec (MicroSeconds)

void serverReliable( UdpSocket &sock, const int max, int message[] );Receives 20K messages and sends 20K ACKS

Do we need to provide a timeout for these ACKS?

Page 99: Direct Link Networks

udp.cpp (& Case 3 TODOs)int clientSlidingWindow( UdpSocket &sock, const int max, int

message[], int windowSize );Sends 20K messages (and obtains 20K ACKs) in sets of WINDOWSIZE Note that you must buffer messages until ACK is obtainedSet timer once window is capped

If timer times out, resend starting with the minimum sequence number not yet ACKed

Count the number of retransmissions and return this count

void serverEarlyRetrans( UdpSocket &sock, const int max, int message[], int windowSize );Receives 20k messages and sends 20K ACKs

These are cumulative ACKSStores sequence numbers of frames already received (in the window)

Page 100: Direct Link Networks

END

Page 101: Direct Link Networks

PDUhttp://en.wikipedia.org/wiki/Protocol_data_uni

tMSS

http://en.wikipedia.org/wiki/Maximum_segment_size

MTUhttp://en.wikipedia.org/wiki/

Maximum_transmission_unit

Page 102: Direct Link Networks

Homework 1 : DescriptionThis is where you analyze the interplay

between link speed, transmission size, and host memory configuration.Inefficiencies can be introduced with

incorrect network tuningAn MSS that is to small, for example

What is the relationship between MSS and MTU?In general, what is the relationship between X and

Y?Which of these variables are fixed, and which

are not?Why is packet size limited to the MSSWhat does the size of the socket buffer

mean?And, How does the memory page size affect

all of this?