data link and physical layers

53
Data Link and Physical Layers

Upload: cedric-grimes

Post on 02-Jan-2016

28 views

Category:

Documents


1 download

DESCRIPTION

Data Link and Physical Layers. Data Link and Physical Layers. Data Link Logical Link Control Medium Access Physical Still protocols, not the physical cable. Medium Access Control. Contention based vs. controlled access Contention Aloha, Ethernet (IEEE 802.3) Controlled access - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Data Link and Physical Layers

Data Link and Physical Layers

Page 2: Data Link and Physical Layers
Page 3: Data Link and Physical Layers

Data Link and Physical Layers

Data Link– Logical Link Control– Medium Access

Physical– Still protocols, not the physical cable

Page 4: Data Link and Physical Layers

Medium Access Control

Contention based vs. controlled access Contention

– Aloha, Ethernet (IEEE 802.3)

Controlled access– Token based protocols (token ring, token bus)

Page 5: Data Link and Physical Layers

Goals:

Minimize Wait Maximize use of resourcesThese are often conflicting goals. If the customer

never has to wait at all, we will probably have servers idle some of the time. If the servers are always busy, customers will have to wait sometimes.

The trick is to compromise in such a way that service is good and resources are well used.

Page 6: Data Link and Physical Layers

Aloha

One central site and many satellite sites Satellite sites cannot hear each other’s

transmissions -- all go through the central site.

If two or more of the satellite sites transmit at the same time, the transmission is garbled and completely lost

Page 7: Data Link and Physical Layers

Aloha model

Remember, any overlapping transmission means failure.

Page 8: Data Link and Physical Layers

Can this possibly work? What is the probability of successful

communication under these conditions? First, we need to understand what is

required for success:– A transmission must begin while no other

transmissions are active– No other transmission may begin while this one

is active.

Page 9: Data Link and Physical Layers

Probability of success

Let’s call the duration of the transmission t We need to be sure that, at the time we start to

transmit– no other station has started transmitting within the

previous time interval, t, and

– no other station will start transmitting for a time interval, t, after we begin to transmit.

How can we possibly know what the other stations have done or will do?

Page 10: Data Link and Physical Layers

A probability model

This is not an uncommon problem. To predict the number of servers needed in a restaurant or a store, someone has to predict how many people will show up in certain periods of time. The problem has been studied and there are well-analyzed models.

The Poisson model is good at analyzing potential results of some kinds of unpredictable events over time.

Page 11: Data Link and Physical Layers

Poisson The Poisson distribution predicts the

number of events to occur in a time period. = the arrival rate = the number of frames per unit of timet = time durationk, n = numbers of frames (events, in general)The Poisson distribution is Pn(t) = ( t)n e- t /n!

So, if we know the rate of occurrence of some event, we can predict the likelihood of exactly n occurrences in a period of time = t

Note that the occurrences are random, not regularly scheduled.There will be periods of time with no occurrences, and others with many occurrences.

Page 12: Data Link and Physical Layers

Examples of the Poisson model

Suppose a new piece of equipment has a rate of failure of 2 per 1000 hours. What is the probability of 2 failures in a single hour?

=2/1000; n=2; t=1 hour Pn(t) = ( t)n e- t /n! P2(1) = (2/1000 * 1)2 e- 2/1000 * 1 /2! P2(1) = 0.00000199600399733467

Page 13: Data Link and Physical Layers

Poisson model for Aloha

Pn(t) = ( t)n e- t /n!

is the rate at which frames are sent t is the time under consideration n is the number of frames sent in the time period.

We need 0 frames sent (by others) in a period 2t

P0(2t) = ( 2t)0 e- 2t /0! = e- 2t

Page 14: Data Link and Physical Layers

Probability of success The probability of success will clearly depend on

the amount of traffic– arrival rate and time remain in the equation

P0(2t) = ( 2t)0 e- 2t /0! = e- 2t

G = t is called the offered load and is a measure of how busy the resource is.

P0(2t) = (2G)0 e- 2G /0! = e- 2G

So, the probability of success for our transmission is e- 2G

Page 15: Data Link and Physical Layers

ThroughputThroughput (S) is a measure of how well we serve the actualload on the system.S=G e- 2G = The offered load times the probability of delivering the frame successfully

The value of S when the slope turns down is 0.183939721Aloha works perfectly well as long as the throughput is not more than 18.4% of capacity

Probability of Successful Transmission in Aloha

00.020.040.060.080.10.120.140.160.180.2

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6

Offered Load

Throughput

Page 16: Data Link and Physical Layers

Aloha and its descendants Pure aloha:packet vulnerable for two times the packet

transmission time Slotted aloha: reduced the vulnerable period to one

times the packet transmission time: S=G e- G

Throughput for Slotted Aloha

0

0.1

0.2

0.3

0.4

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6

Offered Load

Throughput

Throughput drops off at G = 1; max value is 0.367879usage limited to 36.8% of capacity

Page 17: Data Link and Physical Layers

Improving performance Slotted aloha allows use of more of the capacity of

the data channel at the cost of more wait for the senders. – Even if no one else is transmitting, the would-be

sender must wait for the next slot boundary.– Balance overall efficiency of the system with needs of

the individual users

Problem was that the stations could not hear each other’s transmission. What happens if we fix that?

Page 18: Data Link and Physical Layers

CSMA: Carrier Sense Multiple Access

Also called “Listen Before Talk”– listen; if channel clear, transmit; otherwise wait

vulnerability reduced to the time it takes most remote system to know about a transmission

– depends upon the fact that propagation delay is much less than transmission time

variations: – non persistent– p-persistent– 1-persistent

Still don’t know about interference that occurs during transmission due to almost simultaneous transmissions by several stations.

Page 19: Data Link and Physical Layers

Add Collision Detection

CSMA/CD or “Listen While Talk” requires the sender to listen as long as needed to detect

any possible collision requires a recovery process

– binary exponential backoff

Scalability problem: throughput decreases as transmission rates increase.

Simplicity in initialization, station addition and deletion, fault management

This is Ethernet/IEEE 802.3

Page 20: Data Link and Physical Layers

Ethernet/IEEE 802.3

7 1 2/6 2/6 2 46-1500 4 Preamble SFD DA SA L Data FCS

Bytesfield

Preamble: 56 bits alternating 10 used to synchronize the receiverSFD: Start Frame Delimiter. 10101011 to signal beginning of the transmissionDA/SA: Destination and Source AddressesL: Length of the data partData: Minimum length required for proper operation. Padding used if neededFCS: Frame Check Sequence: Extra bits appended for error checking: the CRC

Page 21: Data Link and Physical Layers

Ethernet specification

Maximum frame size:– 1518 bytes not counting the 8-byte preamble– 1526 bytes counting everything

Minimum packet size:– 72 bytes counting the preamble

Minimum packet spacing:– 9.6 seconds between end of one transmission

and beginning of next

Page 22: Data Link and Physical Layers

Scaling What happens if the 10Mbps Ethernet is changed

to 100Mbps?– Bit speed does not change; what does?

• How big is a bit?

• Speed of light is 299,792,458 meters per second• transmission of data cannot quite achieve that, but comes fairly

close.• Assume .8 * speed of light for the speed of the electrons

representing our bits.• Let’s make life easier by using round numbers:• 300,000,000 meters per second for light; .8 times that for the bits;

100Mbps = 100 Million (not the proper power of 2)• So, how big is a bit? How big is a bit at 10 Mbps?

Page 23: Data Link and Physical Layers

How big is a bit?At 100Mbps:1 second .8 * 300,000,000 meters--------- * --------------------- = 2.4 meters/bit100,000,000 bits second

At 10Mbps:1 second .8 * 300,000,000 meters--------- * --------------------- = 24 meters/bit10,000,000 bits second

For a 72 byte minimum frame size:72 bytes 8 bits 24 meters-------- * ------ * -------- = 13824 meters/frame frame byte bit

(Remember that 1 kilometer is 1,000 meters and is about .6 mile) A minimum frame is measured in miles!

Page 24: Data Link and Physical Layers

Scaling, mathematically speakingThroughput is the reciprocal of the average time required to launch a message successfully:m is the time needed to transmit the message is the time to travel the entire length of the network.Worst case time to detect collision = 2If average number of retransmissions is J,

then 2 J time is required to resolve the collisionAverage time required to launch a message successfully is then m + + 2 J.The only unknown is J, the average number of retransmissions.

v = probability of success after one attempt to transmit(1-v)v = probability of success after two attempts….(1-v)k-1v = probability of success after k attempts, etc.Average number of retransmissions required is sum over all k of k*probability of success after k tries:

J = ∑v(1-v) k-1 = 1/v

k=1,

Page 25: Data Link and Physical Layers

Scaling, continued

J = ∑ v(1-v) k-1 = 1/v

k=1,Probability that a station wants to transmit in a 2 interval is pThe probability that exactly one station transmits and is successful is

v= n p(1-p)n-1

Maximum v occurs when p = 1/n and thus vmax = n(1/n)(1-1/n)n-1 = (1-1/n) n-1 --> e-1, n-->

So, J = 1/v --> e and t = m(1+a(1+2J)) = m(1+a(1+2e))

time to launch a message successfully is t = m(1+6.44a)time to launch a message successfully is t = m(1+6.44a)

Page 26: Data Link and Physical Layers

Scaling: the bottom linet=m(1+6.44a)

S = m/tv =<= 1/(1+6.44a) ; a= /m

This is the bottom line. Throughput is dependent on a; a is the ratio between the time it takes to reach the farthest removed station and the length of time it takes to transmit the message. (Propagation time/transmission time)

This shows that if we decrease the length of time it takes to launcha message (by increasing the transmission speed), we increase a and decrease throughput. To compensate, we have to reduce themaximum propagation delay -- which can only be done by makingthe longest cable distance smaller.That is why 100 Mbps Ethernet have shorter distance restrictions

Page 27: Data Link and Physical Layers

The Token Ring Controlled access; no collisions to

resolve Having a token requires a way to

recover from token loss -- a monitor

Page 28: Data Link and Physical Layers

Token Ring Frame Format

1 1 1 2/6 2/6 <5000 4 1 1 bytes

SD AC FC DA SA LLS FCS ED FS field

SD = START DELIMITERED = END DELIMITERAC = ACCESS CONTROLFC = FRAME CONTROLSA/DA = SOURCE/DESTINATION ADDRESSESFS = FRAME STATUSFCS = FRAME CHECK SEQUENCE

Token = SD AC ED

Page 29: Data Link and Physical Layers

The token

start delimiter: JK0KJ000• J, K are signals that cannot be mistaken for 0 or 1

end delimiter: JK1JK1IE• I for intermediate (1) or last (0)• E for error detected

Access Control: PPPTMRRR• PPP: priority• T: token (1) or data frame (0)• M: monitor has seen this (1) or not (0)

frame control : FFZZZZZZ • identifies the frame as MAC or LLC • allows the MAC and LLC protocols to communicate with peers

Page 30: Data Link and Physical Layers

Token Ring continued Source and destination addresses

– 16 or 48 bits, first bit indicates individual or group address; same standard as ethernet

FCS: Frame check sequence (CRC) Frame status: ACxxACxx

– Address recognized– Frame Copied to host

Scalability– same problem as CSMA/CD

Page 31: Data Link and Physical Layers

FDDI

Similar to Token Ring, but with differences to help it scale– Five bit codes to represent four data bits– latency: each station must receive 10 bits before

passing on– No designated monitor

responsibilities shared by all the interface units Early token release

Page 32: Data Link and Physical Layers

DQDB

IEEE 802.6 (MAN) Two unidirectional buses communicate by inserting message into the

first available slot slots are 53 octets to match ATM technology Though it is accepted as a standard, some

fairness problems remain and are the subject of current study

Page 33: Data Link and Physical Layers

802.11

IEEE Standard for wireless networks CSMA/CA (collision avoidance)

– Cannot use CSMA/CD because the transmitting node cannot hear other transmissions

– Listen. If channel clear, transmit. If channel busy, generate a random backoff factor. Continue to listen. If channel is clear, decrement the backoff counter; otherwise do not decrement. When backoff counter reaches 0, transmit.

– Idea is that it is unlikely that two or more nodes will choose the same random number. If they do, then a collision occurs, the transmission fails, and higher layers will recognize the failure and cause a retry.

Page 34: Data Link and Physical Layers

Wireless transmission initiation

Sender transmits special RTS (ready to send) signal. Intended receiver responds with CTS (clear to send).

This is necessary to avoid problem of interference from a node that the sender cannot hear but the receiver can hear (the hidden node problem).

A B C

If A wants to transmit to B, it would not hear C transmitting to B

Page 35: Data Link and Physical Layers

Standards variations

* 802.11 -- applies to wireless LANs and provides 1 or 2 Mbps transmission in the 2.4 GHz band using either frequency hopping spread spectrum (FHSS) or direct sequence spread spectrum (DSSS).

* 802.11a -- an extension to 802.11 that applies to wireless LANs and provides up to 54 Mbps in the 5GHz band. 802.11a uses an orthogonal frequency division multiplexing encoding scheme rather than FHSS or DSSS.

* 802.11b (also referred to as 802.11 High Rate or Wi-Fi) -- an extension to 802.11 that applies to wireless LANS and provides 11 Mbps transmission (with a fallback to 5.5, 2 and 1 Mbps) in the 2.4 GHz band. 802.11b uses only DSSS. 802.11b was a 1999 ratification to the original 802.11 standard, allowing wireless functionality comparable to Ethernet.

* 802.11g -- applies to wireless LANs and provides 20+ Mbps in the 2.4 GHz band.

http://www.webopedia.com/TERM/8/802_11.html

Page 36: Data Link and Physical Layers

Wireless vs. Mobile

Wireless networks connect to wired hubs which participate in the local network according to standard protocols.

Mobile hosts move from network to network using one of several methods to stay connected

Page 37: Data Link and Physical Layers

Error Control Error detection vs. error correction

– detection is relatively easy; correction comes with high cost

Block parity check– Arrange the bits in a two-dimensional array, perhaps one character

per row and some number of characters giving the number of rows.– Use a parity bit for each row and one for each column– vulnerable to burst type errors, which are common

Polynomial encoding -- the CRC, for example– Very reliable, but not perfect

Page 38: Data Link and Physical Layers

CRC

The basic idea: choose a divisor, send a value that

is known to be evenly divisible by the divisor.

Also send the modification to the original data that

made it evenly divisible.

Receiver checks the division. If any remainder, the

transmission contains an error.

Page 39: Data Link and Physical Layers

CRC polynomial

Interpret the bits to be sent as the coefficients of a polynomial:– 0001010010 represents– 0x9 + 0x8 + 0 x7 + 1x6 + 0x5 + 1x4 + 0x3 + 0x2 + 1x1+ 0x0

Agree on a common polynomial to divide by such that the remainder will be 0

Shift the polynomial by the degree (n) of the common polynomial divisor (multiply the data polynomial by xn )

Divide, then subtract the remainder from the shifted polynomial before transmitting.

Receiver verifies that division yields no remainder and can easily see the original data by dropping off the extra bits

Page 40: Data Link and Physical Layers

CRC checking

Append 0s to the data --- as many as the degree of the divisor polynomial

Divide Subtract the remainder from the augmented

polynomial and transmit. Example:

– data = 0010100100101010010101001001; generator polynomial = 100101

Page 41: Data Link and Physical Layers

How dependable is the CRC?

Andrew Tannenbaum analysis:– Suppose an error occurs in a transmission

• T(x) is the correct transmission

• T(x) + E(x) is received. E(x) represents the error.– Each 1 in E(x) corresponds to a bit that has been inverted.

– If there are k 1 bits in E(x), k single bit errors

– A single burst error: a 1 followed by some combination of 0s and 1s and a final 1. All other bits = 0.

• Receiver dividesT(x) + E(x) by the generating polynomial, G(x)

– (T(x) + E(x))/G(x) = T(x)/G(x) + E(x)/G(x) = 0 + E(x)/G(x)

– If E(x)/G(x) = 0, the error will not be detected. How likely is that?

Page 42: Data Link and Physical Layers

Dependability of CRC

Undetected errors E(x)/G(x) = 0– Single bit error: E(x) = xi, i = error bit.

• If G(x) has more than one term, it will not divide evenly. So any G(x) of more than one term will detect all single bit errors.

– Two isolated single bit errors: E(x) = xi +xj, i>j• E(x) = xj (xi-j +1). Assume not divisible by x (case 1).

Then sufficient to be sure that G(x) does not divide xk +1 for any k up to maximum value of i-j.

– Good examples are known. X15 + x14 +1 will not divide xk +1 for any value of k below 32,768.

Page 43: Data Link and Physical Layers

Dependability of CRC– An odd number of error bits: E(x) - odd number of terms

• Fact: no polynomial with an odd number of terms has x+1 as a factor in the modulo 2 system. Thus, if x+1 is a factor of G(x), all errors consisting of an odd number of bits will be caught.

Demonstration: Assume E(x) has an odd number of terms and is divisible by

x+1. Factor E(x)=(x+1)Q(x). Evaluate E(1) = (1+1)Q(1)Modulo 2: E(1) = 0 * Q(1); E(1) = 0.If E(x) has an odd number of terms, substituting 1 for each x

will always yield 1 as a result. Thus, no polynomial with an odd number of terms is divisible by x+1.

Page 44: Data Link and Physical Layers

Dependability of CRC

A polynomial code with r check bits will always detect burst errors of length <=r.– Burst error of length k = xi(xk-1+…+1) where I

determines how far from the right hand end of the received frame the error burst begins.

– For the error to be missed, either xi or xk-1 must =0. – If G(x) contains an x0 term (ends in +1), xi is not

divisible by G(x). – If k-1 is < degree of G(x), the remainder will not = 0.

So, all burst errors of length <= r will be detected if G(r) has at least degree r.

Page 45: Data Link and Physical Layers

Dependability

Burst error > r bits Will go undetected iff the remainder after

division by G(x) = 0 That will happen only if the burst is exactly

the same as G(x). First and last bits of each are 1, so must look at r-1 intermediate bits.

If all combinations equally likely, probability = (1/2) r-1

Page 46: Data Link and Physical Layers

Dependability of CRC summary

International Standards:– CRC-12 = x12+x11+x3+x2+x+1– CRC-16= x16+x15+x2+1– CRC-CCITT = x16+x12+x5+1

All contain x+1 as a factor The 16 bit codes catch all single and double errors,

all erros with an odd number of bits, all burst errors of length 16 or less, 99.997% of 17-bit bursts and 98.998% of 18-bit and longer bursts.

Page 47: Data Link and Physical Layers

Framing

Checksums assume that we have a fixed length transmission of known size.

One job of the data link layer is to break the stream of bits into discrete chunks, append an error check sequence (often the CRC) and transmit. The receiver rechecks the CRC but needs to know where the fame boundaries are.

Page 48: Data Link and Physical Layers

Framing

Framing is the process of marking the endpoints of a transmission.

Principal methods– Character count– Begin and end marker characters– Begin and end marker flags– Physical layer coding violations

Page 49: Data Link and Physical Layers

Character count

We saw it used in the header at higher layers, where bit errors have been corrected.

Problem at the data link layer is that the character count itself may be corrupted. Then there is no clue where the frame ends

Page 50: Data Link and Physical Layers

Framing Special character codes ASCII codes available for the purpose:

– DLE (data link escape, means something with special significance to the DL layer is coming)

– STX (start Text) Beginning of the frame.– ETX (end Text) Ending of the frame

Disadvantage is the character orientation. What to do with binary data

Suppose the data contains DLE? Stuff in an extra one. Anytime DLE is followed by DLE it means DLE was transmitted. Suppose DLE STX is in the data? The character stuffing works then also.

Page 51: Data Link and Physical Layers

Framing Flags and bit stuffing

– flag = 01111110– bit stuffing = make sure the flag does not

occur anywhere in the actual data transmitted• Whenever the sender sees a pattern of five

consecutive 1's, insert a 0. • Whenever the receiver sees a pattern of five

consecutive 1's followed by 0, delete the 0.

Page 52: Data Link and Physical Layers

Physical Layer Coding Violations

Physical layer coding violations– using something other than the agreed

representation of 1 or 0 and giving it a special meaning. (the J and K in the token ring start delimiter, for example)

Page 53: Data Link and Physical Layers

Reference

Tannenbaum, Andrew S. Computer Networks 3rd edition. Prentice Hall. 1996