Title: Data Link and Physical Layers
1Data Link and Physical Layers
2(No Transcript)
3Data Link and Physical Layers
- Data Link
- Logical Link Control
- Medium Access
- Physical
- Still protocols, not the physical cable
4Medium Access Control
- Contention based vs. controlled access
- Contention
- Aloha, Ethernet (IEEE 802.3)
- Controlled access
- Token based protocols (token ring, token bus)
5Goals
- Minimize Wait
- Maximize use of resources
- These 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.
6Aloha
- One central site and many satellite sites
- Satellite sites cannot hear each others
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
7Aloha model
Remember, any overlapping transmission means
failure.
8Can 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.
9Probability of success
- Lets 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?
10A 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.
11Poisson
- The Poisson distribution predicts the number of
events to occur in a time period.
? the arrival rate the number of frames per
unit of time t time duration k, 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.
12Examples 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 n2 t1 hour
- Pn(t) (? t)n e- ? t /n!
- P2(1) (2/1000 1)2 e- 2/1000 1 /2!
- P2(1) 0.00000199600399733467
13Poisson 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
14Probability 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
15Throughput
Throughput (S) is a measure of how well we serve
the actual load on the system. SG e- 2G The
offered load times the probability of delivering
the frame successfully
The value of S when the slope turns down is
0.183939721 Aloha works perfectly well as long as
the throughput is not more than 18.4 of capacity
16Aloha and its descendants
- Pure alohapacket vulnerable for two times the
packet transmission time - Slotted aloha reduced the vulnerable period to
one times the packet transmission time SG e- G
Throughput drops off at G 1 max value is
0.367879 usage limited to 36.8 of capacity
17Improving 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
others transmission. What happens if we fix
that?
18CSMA 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 dont know about interference that occurs
during transmission due to almost simultaneous
transmissions by several stations.
19Add 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
20Ethernet/IEEE 802.3
7 1 2/6 2/6 2 46-1500
4 Preamble SFD DA SA L Data FCS
Bytes field
Preamble 56 bits alternating 10 used to
synchronize the receiver SFD Start Frame
Delimiter. 10101011 to signal beginning of
the transmission DA/SA
Destination and Source Addresses L Length
of the data part Data Minimum length
required for proper operation. Padding
used if needed FCS Frame Check
Sequence Extra bits appended for error
checking the CRC
21Ethernet 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
22Scaling
- 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. - Lets 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?
23How big is a bit?
At 100Mbps 1 second .8 300,000,000
meters --------- --------------------- 2.4
meters/bit 100,000,000 bits second At
10Mbps 1 second .8 300,000,000
meters --------- ---------------------
24 meters/bit 10,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!
24Scaling, mathematically speaking
Throughput 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
2? If average number of retransmissions is J,
then 2 ? J time is required to resolve the
collision Average 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
kprobability of success after k tries
J ?v(1-v) k-1 1/v
k1,?
25Scaling, continued
J ? v(1-v) k-1 1/v k1,?
Probability that a station wants to transmit in a
2? interval is p The 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 --gt
e-1, n--gt ? So, J 1/v --gt e and t
m(1a(12J)) m(1a(12e)) time to launch a
message successfully is t m(16.44a)
26Scaling the bottom line
tm(16.44a) S m/tv lt 1/(16.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 launch a message (by increasing
the transmission speed), we increase a and
decrease throughput. To compensate, we have to
reduce the maximum propagation delay -- which can
only be done by making the longest cable distance
smaller. That is why 100 Mbps Ethernet have
shorter distance restrictions
27The Token Ring
- Controlled access no collisions to resolve
- Having a token requires a way to recover from
token loss -- a monitor
28Token Ring Frame Format
1 1 1 2/6 2/6 lt5000 4 1 1
bytes SD AC FC DA SA LLS FCS ED
FS field
SD START DELIMITER ED END DELIMITER AC
ACCESS CONTROL FC FRAME CONTROL SA/DA
SOURCE/DESTINATION ADDRESSES FS FRAME
STATUS FCS FRAME CHECK SEQUENCE
Token SD AC ED
29The 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
30Token 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
31FDDI
- 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
32DQDB
- 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
33802.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.
34Wireless 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).
If A wants to transmit to B, it would not hear C
transmitting to B
A
B
C
35Standards 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
36Wireless 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
37Error 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
38CRC
- 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.
39CRC 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
40CRC 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
41How 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?
42Dependability 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,
igtj - 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.
43Dependability of CRC
- An odd number of error bits E(x) - odd number of
terms - Fact no polynomial with an odd number of terms
has x1 as a factor in the modulo 2 system.
Thus, if x1 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 x1. Factor E(x)(x1)Q(x). - Evaluate E(1) (11)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 x1.
44Dependability of CRC
- A polynomial code with r check bits will always
detect burst errors of length ltr. - Burst error of length k xi(xk-11) 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 lt degree of G(x), the remainder will
not 0. - So, all burst errors of length lt r will be
detected if G(r) has at least degree r.
45Dependability
- Burst error gt 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
46Dependability of CRC summary
- International Standards
- CRC-12 x12x11x3x2x1
- CRC-16 x16x15x21
- CRC-CCITT x16x12x51
- All contain x1 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.
47Framing
- 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.
48Framing
- 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
49Character 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
50Framing
- 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.
51Framing
- 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.
52Physical 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)
53Reference
- Tannenbaum, Andrew S. Computer Networks 3rd
edition. Prentice Hall. 1996