1
Medium Access Control 2 Medium Access Control (1)
The Network
H2 H4
H1 H3
Broadcast networks have possibility of multiple 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
H2 H4
H1 H3 4 Medium Access Control (3)
The Network
H2 H4
H1 H3 5 Medium Access Control (4)
The Network
H2 H4
H1 H3 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 The Network The Network The Network H2 H4 H2 H4 H2 H4 H2 H4
H1 H3 H1 H3 H1 H3 H1 H3
ALOHA is contention based: a host may broadcast whenever necessary
higher layers spot errors caused by collisions, and do retransmission 7 Performance of ALOHA
H n vulnerable period for -1 start (λt) −λt Pn(t)= e t1 + t2 n! H1 To find p from Poisson Equation - t set t = 2T, λ = µG, n = 0: t2 -1 0 (µ 2T ) − H2 p = G e µG2T t1 + t2 - 0! −µG2T vulnerable period for H2 start p = e µ − S = e µG2T Let t1 = t2 = T µG µS successfully sent per second −µG2T µS = µGe µG sent (including failures) per second p is probability frame has no collisions µST frames are delivered in T µ seconds p = S µG −µG2T ρ = µST = µGe T 8 Is ALOHA good? ρ 6 0.4
0.3
0.2
0.1
0.0 - 0.0 0.5 1.0 1.5 2.0 2.5 3.0 µGT 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 may broadcast. 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 token permitting it to do so. 4. distributed queueing: the hosts collaborate to form a queue of hosts ready to send data. 10 Slotted ALOHA
n (λt) −λt vulnerable period for H1 start P (t)= e - n n! To find p from Poisson Equation H1 set t = T, λ = µG, n = 0: - t 0 (µ T ) − p = G e µGT H2 0! − - p = e µGT vulnerable period for H2 start µ − S = e µGT µG µS successfully sent per second − µ = µ e µGT µG sent (including failures) per second S G p is probability frame has no collisions µST frames are delivered in T µ p = S seconds µG −µGT ρ = µST = µGe T 11 Is Slotted ALOHA good? ρ 6 0.4
0.3
0.2
0.1
0.0 - 0.0 0.5 1.0 1.5 2.0 2.5 3.0 µGT 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 The Network The Network H2 H4 H2 H4 H2 H4
H1 H3 H1 H3 H1 H3 carrier sensing involves TI - checking that channel is idle H2 before transmission called CSMA U H1 probability TI of avoiding - TI +TP - TCS a collision TP 13 Collision Detection
H3 causes collision H2 causes collision H1 H2 H3 H3 H2 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 called CSMA/CD host must transmit for long enough so as to know frame is OK thus minimum frame length is 2η 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 of 200 × 106ms−1, and a bit rate 1Mbs−1.
1. If two hosts H1, 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, and H2 starts to broadcast just before the signal
from H1 arrives at H2, what will happen?
3. How long, from the time H1 starts transmitting, will it take H1 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 length l on the bus?
l We know that the end-to-end propagation delay η = 200×106 64 −6 Also, the time to transmit a frame t = 10×106 = 6.4 × 10 Since the time to transmit a frame must be greater than 2η, we have:
− 2l 6.4 × 10 6 > 200 × 106 l < 640m 16 Persistence
Used slot N 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 probability p → p-persistent CSMA if p = 1 → simply waiting for the channel to be free before broadcasting if p< 1 then wait with probability 1 − p for one frame, before broadcasting with probability p 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 called binary 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
after c collisions we choose a slot in the range 0 to 2c − 1 for the next attempt upper limit of 1023 is placed on what this range 18 Binary Exponential Back-off (Light Load)
Slot Slot Slot Slot 0 1 0 1 0 1 0 1 H2 H2 H2 H2
H1 H1 H1 H1
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)
Slot Slot Slot Slot Slot Slot Slot 0 1 0 1 0 1 0 1 0 1 0 1 0 1 H5 H5 H5 H5 H5 H5 H5
H4 H4 H4 H4 H4 H4 H4
H3 H3 H3 H3 H3 H3 H3
H2 H2 H2 H2 H2 H2 H2
H1 H1 H1 H1 H1 H1 H1
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 very likely
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
H2 H3
direction logical 6 node outside of ring of H4 logical ring token hosts token H1 H5
Hosts must posses a token 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 bandwidth available for data. η is the average delay between hosts
B bits per second network timeout at each host is T
The maximum frame size f obeys
f = TB
The maximum delay d given by
d = N (η + T ) 23 IEEE 802 standard for LANs
OSI IEEE
Network Layer OSI Network Layer
802.2 LLC Sub-layer Data Link Layer 802.1D Bridging Sub-layer 802.3 802.4 802.17 MAC MAC MAC Sub-layer Sub-layer . . . Sub-layer Physical 802.3 802.4 802.17 Layer Physical Physical Physical Layer Layer Layer
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
byte0 byte1 byte2 byte3 byte4 byte5 I/ U/ local local local OUID OUID OUID G L id id id
Each NIC card conforming to IEEE Standards will have 48 bit number written as six colon separated bytes in hex hbytei:hbytei:hbytei:hbytei:hbytei:hbytei I/G bit decides if individual or group address
U/L bit decides if universally or locally administered host 00:90:27:A3:32:05 individual globally unique broadcast address FF:FF:FF:FF:FF:FF group locally unique
allows for 7 × 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 Ring LAN 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 1 10Base5 Thick Ethernet 2 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 of drops 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 Ethernet 10Base-2 Thin Ethernet H H 10Base-T Twisted Pair Ethernet H H H repeater repeater hub H
H H H H H H
host H H 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
7 1 6 6 2 0-1500 46-0 4 0+ S destination source len/ E preamble T data pad CRC X X address address type T
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 addition of faster machines
f 2l ∝ B c
1 end-to-end length ∝ 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 hub hub hub H H
H H H H 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
1 end-to-end ∝ bit rate if 10Mbs−1→ 2500m, then 1Gbs−1→ 25m CSMA/CD unaltered would lead to maximum end-to-end lengths of 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) to make one long frame 37 Avoiding CSMA/CD: Full Duplex Mode
H H H H H H
H H switch switch switch H H
H H H H 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
H6 H7 H8
wired LAN portal distribution system
BSS1 BSS2 BSS3 H2 H5
AP1 AP2 AP3 H1 H3 H4
In practice, portal is built into APs. 39 802.11 Frame Format
bytes 2 2 6 6 6 2 6 ≤ 2312 4 dur destination source FC address 3 SC address 4 data CRC ID address address
to from more pwr more type retry WEP order ver subtype DS DS frag mgt data
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) uses RC4 encryption
WiFi portected access (WPA) uses AES encryption 40 802.5 Token Ring
H2 H3 H2 H3 logical physical direction node outside direction of 6 ring of H4 logical ring of 6 ring of H4 token hosts token hosts token token H1 H5 H1 H5
for token passing MAC, rings topology is natural implementation technique
physical ordering of hosts → logical order for token passing. in the token ring, each host may operate in two modes:listen mode or transmit mode 41 Listen mode
→ F host F → buffer
CPU
Hn uses a single bit buffer to copy input bit stream from Hn−1 to Hn+1. Host keeps copy of any frame addressed to it. 42 Transmit Mode
host → Fin Fout → buffer
CPU
Hn reads the bit stream from Hn−1 into memory, and transmits a frame from its memory to Hn+1 The whole frame need not fit on the ring → any frame length may be used 43 Token Ring: Token Passing (1)
F →H1 → T → H2 H3 buffer buffer buffer
CPU CPU CPU
Only one host in Tx mode Drains off frame F it send, and places token T on ring
early release mode means token placed on ring before F arrives back All other hosts will be in listen mode 44 Token Ring: Token Passing (2)
H1 →T → H2 → T → H3 buffer buffer buffer
CPU CPU CPU
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 H2 T → H3 F buffer buffer buffer
CPU CPU CPU
After sending token, host switches to listen mode Host wanting to Tx can spot token in buffer
Switches to transmit mode drains off T sends data frame F 46 Token Ring Frames
1 1 1 6 6 0-30 0+ (timer limited) 4 1 11+ S E I A F source route F T destination T F C C data CRC S X address address information X G
1 1 1 S E A T T C X X
access control (AC) field at the start of all frames a single bit to denote presence of token priority bits: priority level of frame reservation bits priority of the data waiting to be sent The frame status (FS) 47 Token Ring: Claiming the Token
H1 → T2 → H2 H3 buffer buffer buffer
CPU CPU F1 CPU F2
Can only claim token if data of priority of data high enough
H2 has priority 1 data F1 → can not take priority 2 token T2 48 Token ring: Reserving the Token
H1 H2 ′ H3 F2 → →F2 buffer buffer buffer
CPU CPU F3 CPU
Host is listen mode might have high priority data to send Can increase reservation priority
Token T always generated with priority of reservation bits in F This priority scheme may cause low priority data to be delayed indefinitely 49 Token Ring: Acknowledgement
↓ ↑ F ′ H1 →F → H2 → F → H3 F ′ buffer buffer buffer
CPU CPU CPU
The frame 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
Use FC 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 the monitor, must take responsibility for generating a token 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
H1 H2 H3 H1 H2 H3
↑↓↑↓↑↓ ↑ ↓ ↑ ↓
→ → → → → concentrator concentrator
Rings are unreliable — one break means no ring Wiring concentrators can switch out fault hosts/breaks 52 Fibre Distributed Data Interface (FDDI)
B A A
Class A hosts attached to both rings B B Class B hosts attached only to one
A A → ← ring based network, token passing optical fibre cabling → supports high data transmission rates over long distances 125MHz clock over 100km 4B5B synchronous coding → effective bit rate is 100Mbs−1 53 Faulty Class B
B A A
B
A A
← Any faulty class B host will only affect one ring 54 Breaks in Ring/Faulty Class A
B A
B B
A A → ← 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
≥ 8 1 1 6 6 timer limited 4 1 1.5 S E F source F T destination T preamble C data CRC S X address address X
≥ 8 1 1 1 S E F T T preamble C X X unlike Token Ring, no priority bits in the FC the hosts time delay in receiving token → how busy ring is FC → synchronous or asynchronous 56 Ring Size Means Must Release Token Early
H H H 1 → Fa → 2 3 buffer buffer buffer
CPU CPU CPU
H H H 1 → T → 2 → Fa → 3 buffer buffer buffer
CPU CPU CPU
↑ H H H 1 2 → Fb → 3 → Fa buffer buffer buffer
CPU CPU CPU 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
0 2 4 6 Token Hn Hn Hn Hn transmissions given a priority level of 0 (lowest), 2, 4, or 6 (highest)
0 2 4 6 in effect, each Hn contains four separate hosts Hn, Hn, Hn, Hn 6 when Hn receives token, passes it to Hn, 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 frame size f (f = TB, where T is the host timeout and B the channel bit rate) that should be assigned to priority 6 traffic if this carries the voice traffic on a 25 host network. Total voice traffic from all hosts = 25 × 64 × 103 = 1.6 × 106bs−1 1.6×106 Priority 6 traffic must have proportion of f = 10×106 = 0.16 61 Token bus frame format
Bytes in each field 7 1 1 6 6 0-8174 4 1 S E F source T destination T preamble C data CRC X address address X
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−1 Hn Hn+1 logical ring of hosts physical bus token Hn−2 Hn+2
Each host Hn knows who is its successor Hn+1
token: sent from Hn to Hn+1; transfer the permission to broadcast frames.
who follows: sent by Hn when it realises Hn+1 has failed, to find Hn+2
solicit successor: sent by Hn to find hosts between Hn and Hn+1 wanting to join ring claim token: sent by a host during initialisation
set successor: sent by Hn when to leave the logical ring, giving the address of Hn+1. Hn−1 will set Hn+1 to be its successor.