medium access control - department of computing, imperial …pjm/nac/lecture_mac.pdf · 2009. 11....
TRANSCRIPT
-
1
Medium Access Control
-
2
Medium Access Control (1)
The Network
H1
H2
H3
H4
Broadcast networks have
possibility ofmultiple access (MA) to a channel
medium access control describes how we resolve the conflict
assume only one channel available for communication
additional channels would also be the subject of MAC
-
3
Medium Access Control (2)
The Network
H1
H2
H3
H4
-
4
Medium Access Control (3)
The Network
H1
H2
H3
H4
-
5
Medium Access Control (4)
The Network
H1
H2
H3
H4
assume when two frames overlaps at the Rx then both are lost, and thus both must
be retransmitted
assumption always be true in LANs
in broadcast WANs might not be true
-
6
ALOHA protocol
You can do nothing for MAC . . .
The Network
H1
H2
H3
H4The Network
H1
H2
H3
H4The Network
H1
H2
H3
H4The Network
H1
H2
H3
H4
ALOHA is contention based: a host may broadcast whenever necessary
higher layers spot errors caused by collisions, and do retransmission
-
7
Performance of ALOHA
H1
H2
t1 + t2
vulnerable period forH2 start-�
vulnerable period forH1 start
t1 + t2-�
t2 -�t1
-�
Let t1 = t2 = T
µS successfully sent per second
µG sent (including failures) per second
p is probability frame has no collisions
p =µS
µG
Pn(t) =(λt)n
n!e−λt
To findp from Poisson Equation
sett = 2T, λ = µG, n = 0:
p =(µG2T )
0
0!e−µG2T
p = e−µG2T
µS
µG= e−µG2T
µS = µGe−µG2T
µST frames are delivered inT
seconds
ρ = µST = µGe−µG2T T
-
8
Is ALOHA good?
-µGT
6ρ
0.0 0.5 1.0 1.5 2.0 2.5 3.00.0
0.1
0.2
0.3
0.4
load of 50% gives maximum efficiency of 18%
not a very satisfactory performance
no way of assuring that even this maximum efficiency is reached
-
9
Improving basic ALOHA
1. slotted transmission: there are certain specific times when a host maybroadcast.
2. carrier sensing: a broadcast is allowed only when the channel is idle.
3. token passing: a host may only broadcast when it holds some sort of tokenpermitting it to do so.
4. distributed queueing: the hosts collaborate to form a queue of hosts ready tosend data.
-
10
Slotted ALOHA
H1
H2
t-�
vulnerable period forH2 start-�
vulnerable period forH1 start-�
µS successfully sent per second
µG sent (including failures) per second
p is probability frame has no collisions
p =µS
µG
Pn(t) =(λt)n
n!e−λt
To findp from Poisson Equation
sett = T, λ = µG, n = 0:
p =(µGT )
0
0!e−µGT
p = e−µGT
µS
µG= e−µGT
µS = µGe−µGT
µST frames are delivered inT
seconds
ρ = µST = µGe−µGT T
-
11
Is Slotted ALOHA good?
-µGT
6ρ
0.0 0.5 1.0 1.5 2.0 2.5 3.00.0
0.1
0.2
0.3
0.4
now load of 100% loading gives maximum efficiency of 36%
still not a very satisfactory performance
small basic problems as ALOHA
-
12
Carrier Sensing
The Network
H1
H2
H3
H4
The Network
H1
H2
H3
H4
The Network
H1
H2
H3
H4
carrier sensing involves
checking that channel is idle
before transmission
calledCSMA
probability TITI+TP
of avoiding
a collision
H1
H2
TI -�
U
TP
-� TCS-�
-
13
Collision Detection
H3 causes collisionH2 causes collision
H1 H2 H3 H2H3 H1
transmission-�
contention-�
transmission-�
idle-�transmission
-�
host senses the medium to know that its frame is OK
transmission stopped as soon as collision occurs→ collision detection (CD)
MAC protocol calledCSMA/CD
host must transmit for long enough so as to know frame is OK
thus minimum frame length is2η whereη is end-to-end transmission time
-
14
Worksheet: CSMA/CD
A bus based network is being built using CSMA/CD for MAC, a cabling system
with signal propagation speeds of200× 106ms−1, and a bit rate 1Mbs−1.
1. If two hostsH1, H2 are separated by 2,000m, how long does it take for a
signal to travel between them?
2. If H1 has started to broadcast, andH2 starts to broadcast just before the signal
from H1 arrives atH2, what will happen?
3. How long, from the timeH1 starts transmitting, will it takeH1 to find out
about the event in question 2?
4. How many bits would be sent in that time?
5. If the data rate were increased to 10Mbs−1, how many bits would have been
sent?
-
15
Length of bus network using CSMA/CD
A bus-based network transmits 64 bit frames at 10 Mbs−1, propagation speed
c = 200× 106ms−1
What is the maximum end-to-end lengthl on the bus?
We know that the end-to-end propagation delayη = l200×106
Also, the time to transmit a framet = 6410×106
= 6.4× 10−6
Since the time to transmit a frame must be greater than2η, we have:
6.4× 10−6 >2l
200× 106
l < 640m
-
16
Persistence
Used slotN N + 1 N + 2 N + 3
1-persistent 1 0 0
p-persistent p (1− p)p (1 − p)(1 − p)p
non-persistent p p p
once idle, it broadcasts with probabilityp→ p-persistent CSMA
if p = 1→ simply waiting for the channel to be free before broadcasting
if p < 1 then wait with probability1− p for one frame, before broadcasting
with probabilityp
-
17
Binary Exponential Back-off
The basis of the MAC in Ethernet is 1-persistent CSMA/CD
to avoid the poor performance of this protocol when network loads are high, a
variation calledbinary exponential back-off is introduced.
minimum frame length is treated as the slot length
when the net is idle, a host may attempt to broadcast
if a collision occurs, wait either 0 or 1 slots before attempting to broadcast
again
if another collision occurs waits 0, 1, 2 or 3 slots
afterc collisions we choose a slot in the range 0 to2c − 1 for the next attempt
upper limit of 1023 is placed on what this range
-
18
Binary Exponential Back-off (Light Load)
H2
H1
0 1Slot
H2
H1
0 1Slot
H2
H1
0 1Slot
H2
H1
0 1Slot
chances of collisions occurring are slight
during transmission only a few hosts waiting to transmit
probably only have a few hosts in contention
-
19
Binary Exponential Back-off (Heavy Load)
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
H5
H4
H3
H2
H1
0 1Slot
at any one time a number of hosts are likely to be in contention
waiting only a few slots would mean a repeat collision is verylikely
binary exponential back-off algorithm to quickly adapts
-
20
Problems with CSMA/CD
No notion of authority to broadcast
collisions are inevitable
in the worst case, a particular host may be delayed indefinitely
Acceptable for many applications, such as office information systems
Unacceptable for real time systems used in applications such as CAM
time that a host waits must have a fixed upper bound.
bandwidth available to each host must have a fixed lower bound.
-
21
Token Passing
H1
H2 H3
H4
H5
directionof
token6
token
logicalring ofhosts
node outsidelogical ring
Hosts must posses atoken in order to broadcast
token passed from one host to another
host has nothing to send→ pass token on immediately
host has something to send→ sets a timer, and transmits until
the timer expires or,
it has no more data to send
-
22
Token Passing Performance
No losses due to collisions, and therefore most of bandwidthavailable for data.
η is the average delay between hosts
B bits per second network
timeout at each host isT
The maximum frame sizef obeys
f = TB
The maximum delayd given by
d = N (η + T )
-
23
IEEE 802 standard for LANs
PhysicalLayer
Data LinkLayer
NetworkLayer
OSI
. . .802.3
PhysicalLayer
802.3MAC
Sub-layer802.4
PhysicalLayer
802.4MAC
Sub-layer802.17
PhysicalLayer
802.17MAC
Sub-layer
802.1D Bridging Sub-layer
802.2 LLC Sub-layer
OSI Network Layer
IEEE
802 standard sets out a framework:
logical link control (LLC) sub-layer performs ARQ (802.2)
Bridging might be present to link LANs (802.1D)
-
24
IEEE MAC Addressing
I/G
U/L OUID OUID OUID
localid
localid
localid
byte0 byte1 byte2 byte3 byte4 byte5
Each NIC card conforming to IEEE Standards will have 48 bit number
written as six colon separated bytes in hex
〈byte〉:〈byte〉:〈byte〉:〈byte〉:〈byte〉:〈byte〉
I/G bit decides if individual or group address
U/L bit decides if universally or locally administered
host00:90:27:A3:32:05 individual globally unique
broadcast addressFF:FF:FF:FF:FF:FF group locally unique
allows for7× 1013 hosts
-
25
IEEE LAN standards
Number Common Name Area MAC Topology
802.3 Ethernet LAN 1-persistent CSMA/CD Bus/Tree
802.4 Token Bus LAN Token Passing Bus/Tree
802.5 Token Ring LAN Token Passing Ring
802.6 DQDB MAN Distributed Queue Bus
802.9 isoEthernet LAN Ethernet + ISDN Star/mesh
802.11 WiFi LAN CSMA/CA Cellular
802.12 100BaseVG LAN Handshaking from hub Star/tree
802.15 Bluetooth PAN Adaptive FHSS Cellular
802.16 WiMAX MAN Connection oriented Cellular
802.17 Resilient Packet RingLAN to WAN Distributed Queue Ring
-
26
802.3 Ethernet
The IEEE 802.3 works over various cables and speeds
Code Common Name Cable Len (m) Topology
10Base5 Thick Ethernet 12
inch coaxial cable 500 bus
10Base2 Thin Ethernet 75-ohm coaxial cable 180 bus
10BaseT Twisted Pair Ethernet Category 3 UTP 100 star
100Base-TX Fast Ethernet Category 5 UTP 100 star
100Base-FX Fast Ethernet Fibre optic 185 star
1000Base-T Gigabit Ethernet Category 6 UTP (4 pairs) 100 star
10GBase-T 10 Gigabit Ethernet Category 6a UTP (4 pairs) 100 star
10Mbs−1 standards have been in use for many years
100Mbs−1 common
1Gbs−1 common on new computers, hubs still a little expensive
-
27
10Mbs−1 Ethernet
Thick Ethernet:
provides longest lengths
hosts are attached via transceivers
length ofdrops from the main cable must not exceed 50m.
Thin Ethernet:
The cable length must not exceed 200m
broken at hosts, connected via BNC connectors and a T-piece.
Twisted Pair Ethernet:
The telephone cable links each host to a hub
RJ45 telephone connectors used at ends of cable
hub acts as a repeater between cables.
-
28
Internetworking 10Mbs−1 Ethernet
10Base-5 Thick Ethernet10Base-2 Thin Ethernet10Base-T Twisted Pair Ethernet
Hhost
H
H
H
H
H
H H
H
H
H H
H H
repeater repeater hub
repeater copies bits between subnets to run over another cable length.
max of four repeaters→max end-to-end length 2.5km
-
29
Ethernet NIC
-
30
Low Cost Hub
-
31
Ethernet frame format
preamble7
STX
1destination
address
6sourceaddress
6len/type
2data
0-1500pad46-0
CRC4
EXT
0+
real defining feature of ‘Ethernet’
CSMA/CD→ some minimum frame size
this has be set to 512 bits (64 bytes)data frame.
zero length data→ frame length 18 bytes?
pad field is added to make up difference
len< 0x600 or type≥ 0x600
-
32
Ethernet Going Faster
When designed, 10Mbs−1 Ethernet seemed like ‘infinite’ bandwidth
Modern PCs and applications can now handle much higher data rates
Need to keep existing Ethernet hardware, but allow additionof faster machines
f
B∝
2l
c
end-to-end length∝1
bit rate
if 10Mbs−1→ 2500m, then 100Mbs−1→ 250m, 1Gbs−1→ 25m
-
33
802.3u Fast Ethernet 100Base-T Half-Duplex
H
H
H H
H H
H H
H
H
H H
H H
hub hub hub
Most modern Ethernet installations 10BaseT
For standard Ethernet, data rate∝ length
10Mbs−1 Ethernet max=2,500m→ 100Mbs−1 Ethernet max=250m
10BaseT uses short lengths→ run 10BaseT cable at 100Mbs−1
Leave other Ethernet parameters the same
-
34
Gigabyte Ethernet 802.3z
Backbone of networks require even higher speeds than 100Mbs−1
Supports STP cabling (25m), or Fibre optic (550m), via hubs.
Want to mix with 10Mbs−1 and 100Mbs−1 Ethernet
64bytes frame size at 10Mbs−1→ 51µs time
end-to-end∝1
bit rate
if 10Mbs−1→ 2500m, then 1Gbs−1→ 25m
CSMA/CD unaltered would lead to maximum end-to-end lengthsof about 25m
-
35
Keeping CSMA/CD: Carrier Extension
51µs -�
Ethernet Frame Carrier
Any packet< 512 bytes is extended by the host sending a carrier
Keep carrier on to make packet last the time for 512 bytes.
Allows network length to be 200m end-to-end
-
36
Keeping CSMA/CD: Packet Bursting
51µs -�
Ethernet Frame Ethernet Frame Ethernet Frame
Short frames need padding to make then ‘long enough’
Allow hosts to send multiple frames
Several short frames can be used (with carrier in between) tomake one long
frame
-
37
Avoiding CSMA/CD: Full Duplex Mode
H
H
H H
H H
H H
H
H
H H
H H
switch switch switch
Many media are full duplex
10BaseT (i.e. UTP cables) has separate Tx and Rx wires
Switch ensures that collisions never occur
buffer frames
ignore frames for certain channels
Possible to having multiple hosts transmitting simultaneously
-
38
802.11 WiFi
BSS1
AP1
H1
H2
BSS2 BSS3
AP2
H3 H4AP3
H5
distribution system
portal
wired LAN
H6 H7 H8
In practice, portal is built into APs.
-
39
802.11 Frame Format
bytes 2
FC
2durID
6destination
address
6source
address
6
address 3
2
SC
6
address 4
≤ 2312
data
4
CRC
ver type subtype toDSfromDS
morefrag
retrypwrmgt
moredata WEP order
distribution system (DS)
toDS=1→ destination address is AP
fromDS=1→ source address is AP
APs may communicate wirelessly or via LAN
wired equivalent privacy (WEP) usesRC4 encryption
WiFi portected access (WPA) usesAES encryption
-
40
802.5 Token Ring
H1
H2 H3
H4
H5
directionof
token6
token
logicalring ofhosts
node outsidelogical ring
H1
H2 H3
H4
H5
directionof
token6
token
physicalring ofhosts
for token passing MAC, rings topology is natural implementation technique
physical ordering of hosts→ logical order for token passing.
in thetoken ring, each host may operate in two modes:listen mode ortransmit mode
-
41
Listen mode
host
CPU
buffer
→ F →F
Hn uses a single bit buffer to copy input bit stream fromHn−1 to Hn+1.
Host keeps copy of any frame addressed to it.
-
42
Transmit Mode
host
CPU
buffer
→ Fin →Fout
Hn reads the bit stream fromHn−1 into memory, and transmits a frame from
its memory toHn+1
The whole frame need not fit on the ring→ any frame length may be used
-
43
Token Ring: Token Passing (1)
H1
CPU
bufferH2
CPU
bufferH3
CPU
bufferF T→ →→
Only one host in Tx mode
Drains off frameF it send, and places tokenT on ring
early release mode means token placed on ring beforeF arrives back
All other hosts will be in listen mode
-
44
Token Ring: Token Passing (2)
H1
CPU
bufferH2
CPU
bufferH3
CPU
bufferTT →→ →→
After sending token, host switches to listen mode
Host not wanting to Tx can just pass token on
-
45
Token Ring: Token Passing (2)
H1
CPU
bufferH2
CPU
bufferH3
CPU
bufferT F
↑
→
After sending token, host switches to listen mode
Host wanting to Tx can spot token in buffer
Switches to transmit mode
drains offT
sends data frameF
-
46
Token Ring Frames
STX
1AC
1FC
1destination
address
6sourceaddress
6route
information
0-30data
0+ (timer limited)
CRC4
ETX
1FS
1IFG
1+
STX
1AC
1ETX
1
access control (AC) field at the start of all frames
a single bit to denote presence oftoken
priority bits: priority level of frame
reservation bits priority of the data waiting to be sent
Theframe status (FS)
-
47
Token Ring: Claiming the Token
H1
CPU
bufferH2
CPU
buffer
F1
H3
CPU
buffer
F2
T2 →→
Can only claim token if data of priority of data high enough
H2 has priority1 dataF1→ can not take priority 2 tokenT2
-
48
Token ring: Reserving the Token
H1
CPU
bufferH2
CPU
bufferH3
CPU
bufferF2→
F3
→F ′2
Host is listen mode might have high priority data to send
Can increase reservation priority
TokenT always generated with priority of reservation bits inF
This priority scheme may cause low priority data to be delayed indefinitely
-
49
Token Ring: Acknowledgement
H1
CPU
bufferH2
CPU
bufferH3
CPU
bufferF ′ F F F ′
↓
→→ →→
↑
Theframe status (FS) changed by receiver
A=1: the destination host is working
C=1: the destination host correctly read the frame
Acknowledgements part of the I-frame
-
50
Ring Maintenance
UseFC to generate different control frames
do not need any protocols for maintaining the logical ring, since it is directly
implemented by the physical ring
some station, called themonitor, must take responsibility for generating atoken and draining orphaned frames
since the monitor may fail, any host on the network must be able to take on
this function
contention protocols are necessary for deciding who is monitor.
-
51
Wiring Concentrators
concentrator
H1 H2 H3
↑ ↓ ↑ ↓ ↑ ↓
→ →
concentrator
H1 H2 H3
↑ ↓ ↑ ↓
→ → →
Rings are unreliable — one break means no ring
Wiring concentrators can switch out fault hosts/breaks
-
52
Fibre Distributed Data Interface (FDDI)
A
A
A
A
B B
B
←
→
Class A hosts attached to both rings
Class B hosts attached only to one
ring based network, token passing
optical fibre cabling→ supports high data transmission rates over longdistances
125MHz clock over 100km
4B5B synchronous coding→ effective bit rate is 100Mbs−1
-
53
Faulty Class B
A
A
A
A
B
B
←
Any faulty class B host will only affect one ring
-
54
Breaks in Ring/Faulty Class A
A
A
A
B B
B
←
→
Class A hosts may ‘short circuit’ the two rings together
creates new single ring almost twice as long as original
all Class A hosts will still be connected
rings up to 100km long→ FDDI must operate with length up to 200km
-
55
FDDI frame format
preamble≥ 8
STX
1FC
1destination
address
6sourceaddress
6data
timer limitedCRC
4ETX
1FS
1.5
preamble≥ 8
STX
1FC
1ETX
1
unlike Token Ring, no priority bits in theFC
the hosts time delay in receiving token→ how busy ring is
FC→ synchronous or asynchronous
-
56
Ring Size Means Must Release Token Early
H1
CPU
buffer
H2
CPU
buffer
H3
CPU
buffer
Fa →→
H1
CPU
buffer
H2
CPU
buffer
H3
CPU
bufferT →→ Fa →→
H1
CPU
buffer
H2
CPU
buffer
H3
CPU
buffer
Fa
↑
→Fb →→
long rings (about 4200 bytes fits into 100km)
draining off the frame is more complicated
-
57
FDDI-II
supports the transmission of synchronous data
Channels of 6.144Mbs−1 may be allocated to synchronous traffic
adequate to carry 96 ISDN B-channels
four US or three European primary rate services
synchronous frames generated at 8000Hz
pairs of hosts will be allocated a slot (i.e. 64kbs−1)
-
58
802.4 Token Bus
set up in response to the Ethernet standard by users unhappy with CSMA/CD
use of token passing, the variety of speeds and signal modulation techniques
used, make the standard much more complicated than Ethernet.
The physical layer uses 75 ohm coaxial cable in a bus topology
MAC sub-layer uses token passing; forming logical rings between the hosts.
-
59
A Token Bus Host
Hn
H0n H2n H
4n H
6n
� Token����
transmissions given a priority level of 0 (lowest), 2, 4, or 6(highest)
in effect, eachHn contains four separate hostsH0n, H2n, H
4n, H
6n
whenHn receives token, passes it toH6n, so that highest priority Tx sent first
each of ‘sub-hosts’ given timer to divide bandwidth different priorities.
-
60
Assigning Priorities to Transmissions
A token bus is to be used at 10Mbs−1to implement ISDN B-channel (64kbs−1)
voice traffic. Calculate the proportion of the maximum framesizef (f = TB,
whereT is the host timeout andB the channel bit rate) that should be assigned to
priority 6 traffic if this carries the voice traffic on a 25 hostnetwork.
Total voice traffic from all hosts =25× 64× 103 = 1.6× 106bs−1
Priority 6 traffic must have proportion off = 1.6×106
10×106= 0.16
-
61
Token bus frame format
preamble
7STX
1FC
1destination
address
6sourceaddress
6
data
0-8174
CRC
4ETX
1Bytes in each field
a frame control (FC)→ type of frame
no padding of frames is required, since CSMA/CD.
a much longer maximum frame is permitted
-
62
Logical Ring Maintenance
Hn−2
Hn−1 Hn Hn+1
Hn+2token
logical ringof hosts
physical bus
Each hostHn knows who is its successorHn+1
token: sent fromHn to Hn+1; transfer the permission to broadcast frames.
who follows: sent byHn when it realisesHn+1 has failed, to findHn+2
solicit successor: sent byHn to find hosts betweenHn andHn+1 wantingto join ring
claim token: sent by a host during initialisation
set successor: sent byHn when to leave the logical ring, giving the addressof Hn+1. Hn−1 will set Hn+1 to be its successor.