The Medium Access Control Sublayer
The Medium Access Control Sublayer
1
The Channel Allocation Problem
The MAC (Medium Access Control) sublayer is
between the physical layer and the data link layer.
The MAC sublayer is especially important in LANs,
nearly all of which use a multiaccess (or
broadcast) channel as the basis of their networks.
This chapter mainly deals with LANs, other
broadcast networks and their protocols. The key
issue: how to determine who gets to use the
channel when there is competition for it ?
1. Static Channel Allocation in LANs and MANs
2. Dynamic Channel Allocation in LANs and MANs
2
Static Channel Allocation
3
What's the problem with FDM ?
1. If fewer than N users are currently interested in
communication, some portions of spectrum will
be wasted.
2. If more than N users want to communicate,
some of them will be denied permission even if
some users with allocated frequency hardly ever
transmit anything.
3. Even the number of users is N and constant,
when some users are quiescent, no one else can
use their bandwidth so it is simply wasted.
4. For bursty data traffic (peak traffic to mean
traffic ratio of 1000:1), the allocated small
subchannel will be idle most of the time but
unable to handle the peak traffic. 4
Dynamic Channel Allocation in LANs and MANs
1. Station Model.
Independent stations for generating frames.
Once a frame has been generated, the station is blocked until
the frame has been transmitted.
2. Single Channel Assumption. A single channel for all
communication (send and receive), and all stations are equivalent.
3. Collision Assumption. If the transmission of two frames overlap in
time, a collision occurs. All stations can detect collisions. A
collided frame must be retransmitted.
4. Time assumption.
(a) Continuous Time.
(b) Slotted Time.
5. Sense assumption.
(a) Carrier sense. Stations can tell if the channel is in use before
trying to use it.
(b) No carrier sense. Stations cannot sense the channel before
trying to use it.
5
Multiple Access Protocols
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
6
PURE ALOHA
The ALOHA system was used for ground-based radio
broadcasting, but the basic idea is applicable to any system
in which uncoordinated users are competing for the use of a
single shared channel.
Basic idea:
Let users transmit whenever they have data to be sent.
A sender can always find out whether or not its frame was
destroyed by listening to the channel output (due to the
feedback property of broadcasting).
If the frame was destroyed, the sender just waits a random
amount of time and sends it again.
Systems in which multiple users share a common channel in
a way that can lead to conflicts are known as contention
systems.
7
Pure ALOHA
12
Pure Aloha Throughput
0.2
0.18
0.16
0.14
Throughput (S)
0.12
0.1
0.08
0.06
0.04
0.02
0
0 1 2 3 4 5
Average Number of frames per unit time (G)
13
Operation of Protocol
a) Optimum Throughput occurs at G=0.5 or when
1
N
2p
b)Average number of attempts to ensure
successful transmission is
N av n(1 e 2 G ) n 1e 2 G e 2 G
i 1
14
Slotted ALOHA protocol
a) Enhancement of pure ALOHA in that stations
can only start to transmit frame so that it
arrives at the destination at the beginning of
defined time slots of duration T
b)Danger period for this system is only the T
seconds prior to the start of stations frame and
thus E=Np and S=Ge-G
c) For this system, optimum throughput occurs if
G=1
15
Slotted Aloha Throughput
0.4
0.35
0.3
Throughput (S)
0.25
0.2
0.15
0.1
0.05
0
0 1 2 3 4 5
Average Number of frames per unit time (G)
16
Efficiency of Slotted ALOHA
a)Successful throughput S read from
graph (e.g. Soptimum=0.368 or 36.8% of
timeslot contain successful
transmissions)
b)Number of frames with no
transmissions can be found from
Poisson distribution p(k=0)=0.368 or
36.8% slots
c)Remaining time slots must contain
collisions
17
Slotted ALOHA
Slotted ALOHA system:
Time is divided up into discrete intervals, each interval corresponding to one
frame.
A terminal is not permitted to send until the beginning of the next slot.
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
19
Carrier Sense Multiple Access protocols
Protocols in which stations listen for a carrier (i.e., a transmission)
and act accordingly are called carrier sense protocols.
20
Collisions in CSMA
How could collisions happen in CSMA ?
Whenever more than one station detect an idle channel and their
transmission times overlap.
Discussions:
1. What's the effect of signal propagation delay ?
The longer the delay, the more the collisions, and the worse
the performance of the protocol.
24
CSMA/CD can be in one of three states:
contention, transmission, or idle
When two stations both begin transmitting at exactly the same time, how long
will it take them to realize that there has been a collision ?
The minimum time to detect the collision is the time it takes the signal to
propagate from one station to the other.
How long could the transmitting station be sure it has seized the network ? ( or
2 ? where is time equal to the full cable propagation)
It is worth noting that no MAC-sublayer protocol guarantees reliable delivery.
Even in the absence of collisions, the receiver may not have copied the frame
correctly due to various reasons (e.g., lack of buffer space or a missed interrupt).
25
Multiple Access Protocols
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
26
Collision-Free Protocols
Can we avoid collision all together, even during the
contention period ?
Yes. But how ?
One assumption: there are N stations, each with a unique
address from 0 to N 1 ``wired'' into it.
Which station gets the channel after a successful transmission ?
28
The binary countdown protocol
A problem with the basic bit-map protocol is
that overhead is 1 contention bit slot per
station. We can do better than that by using
binary station addresses.
1. Each station has a binary address. All
addresses are the same length.
2. To transmit, a station broadcasts its address
as a binary bit string, starting with high-
order bit.
3. The bits in each address position from
different stations are BOOLEAN ORed
together (so called Binary countdown).
4. As soon as a station sees that a high-order
bit position that is 0 in its address has been
overwritten with a 1, it gives up.
5. After the winning station has transmitted its
frame, there is no information available
telling how many other stations to send, so
the algorithm begins all over with the next
frame.
29
Multiple Access Protocols
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
30
Limited-Contention Protocols
Two basic channel acquisition strategies studied:
a) Contention methods. E.g., ALOHA, CSMA.
b) Collision-free methods. E.g., basic bit map.
35
Adaptive Tree Walk Protocol
Each bit slot (group) is associated with a particular
node in the tree, with the root node corresponding to
slot 0 for all stations in one group.
Starting from the root node: all stations are
permitted to try to acquire the channel.
If a collision occurs, the search continues
recursively with the left and right children of that
node.
If a bit slot goes idle or if there is exactly one
station that transmits into it, the searching of its
node can stop.
36
Multiple Access Protocols
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access
Protocols
Wireless LAN Protocols
37
Wavelength Division Multiple Access Protocols
A different approach to channel allocation is to divide the channel into
subchannels using FDM, TDM, or both, and dynamically allocate them as
needed. This is commonly used on fiber optic LANs.
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
39
Wireless LAN Protocols
A system of computers (e.g., notebook PCs) that communicate by radio can
be regarded as a wireless LAN.
Wireless LANs have different properties than conventional wired LANs and
require special MAC sublayer protocols.
All radio transmitters have some fixed range, so not all stations are necessarily
within range of one another.
a) A transmitting. C is unable to detect As transmission, so it may falsely
conclude that it may transmit to B, resulting in collision. This is called the
hidden station problem)
b) B transmitting. C is able to detect As transmission, so it may falsely
conclude that it may not send to D, which is called the exposed station
problem. 40
Wireless LAN Protocols (2)
ALOHA
Carrier Sense Multiple Access Protocols
Collision-Free Protocols
Limited-Contention Protocols
Wavelength Division Multiple Access Protocols
Wireless LAN Protocols
42
IEEE 802 Standards
The 802 working groups. The important ones are marked with *. The
ones marked with are hibernating. The one marked with gave up.
43
Ethernet
IEEE standard 802.3 and Ethernet
This standard is for a 1-persistent CSMA/CD LAN:
When a station wants to transmit, it listens to the cable.
If the cable is busy, the station waits until it goes idle,
otherwise it transmits immediately.
If a collision occurs, all colliding stations terminate
their transmission, wait a random time, and repeat the
whole process all over again.
44
Ethernet Cabling
No two transceivers may be more than 2.5 km apart, and no path between any
two transceivers may traverse more than four repeaters.
46
Manchester Encoding
None of the Ethernet versions use straight binary encoding since it leads to ambiguities:
it cannot tell the difference between an idle sender (0 volts) and a 0 bit (0 volts).
What is needed is a way for receivers to unambiguously determine the start, end, or
middle of each bit without reference to an external clock.
(a) Binary encoding, (b) Manchester encoding, (c) Differential Manchester encoding.
All Ethernet systems use Manchester encoding due to its simplicity. The high signal is volts
and the low signal is volts, giving a DC value of 0 volts.
47
Ethernet MAC Sublayer Protocol
Another more important reason for having a minimum length frame is to prevent a
station from completing the transmission of a short frame before the first bit has
even reached the far end of the cable, which it may collide with another frame, as
illustrated below.
49
The binary exponential backoff algorithm
After a collision, the station waits for a random time and try again. How the
randomization is done ?
Time is divided into discrete slots whose length is equal to the worst case round
trip propagation time (2).
1. After the first collision, each station waits either 0 or 1 slot time at random.
2. After the second collision, each station waits either 0, 1, 2, or 3 slot times at
random.
3. After i collisions, a random number between 0 and 2**i 1 is chosen, and that
number of slots is skipped.
4. After 10 collisions have been reached, the randomization interval is frozen at
1023 slots.
5. After 16 collisions, the controller gives up and reports failure.
What happens if the randomization interval for all collisions is always 1023?
Think about the average delay when only a few stations collide.
What happens if the randomization interval for all collisions is always 2?
Think about the time needed to resolve the collision when 100 stations try to send
at once. This might take years to resolve.
The mean number of times per transmission is e 2.72. 50
Ethernet Performance
In case that all the ports on the card are wired together to form a local on-card LAN:
Collisions on this on-card LAN will be detected and handled the same as any other
collisions on a CSMA/CD network.
Only one transmission per card is possible at any instant, but all the cards can be
transmitting in parallel.
In case that each input port is buffered, so incoming frames are stored in the card's
on-board RAM as they arrive:
Once a frame has been completely received, the card checks to see if the frame is
destined for another port on the same card, or for a distant port. In the former case
it can be transmitted directly to the destination.
In the latter case, it must be transmitted over the backplane to the proper card.
All input ports can receive (and transmit) frames at the same time, for parallel,
full-duplex operation.
53
Fast Ethernet
The Fast Ethernet (IEEE 802.3u) is backward compatible with but faster than the existing
802.3 standard.
All the 802.3 packet formats, interfaces, and procedural rules are kept, but the bit time is
reduced from 100 (10 Mbps) nsec to 10 nsec (100 Mbps).
Fast Ethernet is based entirely on twisted pair or fiber wiring, as shown below.
1. 100Base-T4 uses four twisted pairs (three for traffic from the station to the hub, one
for the reverse traffic). Each pair runs at a signaling speed of 25 MHz. 4 bits (by the
8B6T scheme) are transmitted per clock cycle via three twisted pairs (to give
100Mbps), and another twisted pair provides a reverse channel at 33.3 Mbps.
2. 100Base-TX uses two twisted pairs (one for each direction), each running at a
signaling speed of 125 MHz. The 4B5B scheme is used to transmit 4 bits per 5 clock
cycles via each twisted pair (to give a full-duplex 100 Mbps).
3. 100Base-F uses two strands of multimode fiber, one for each direction, to give full
duplex 100 Mbps. The distance between the station and the hub can be up to 2 km.
54
Gigabit Ethernet
The Gigabit Ethernet (IEEE 802.3z) is backward compatible with but faster than the
existing 802.3 and 802.3u standards, but goes 10 times faster than 802.3u.
Gigabit Ethernet uses new encoding schemes, rather than Manchester encoding.
Gigabit Ethernet supports flow control: one end can send a special control frame
to the other end telling it to pause for some period of time. The time unit is
512 nsec, allowing for pause as long as 33.6 msec.
IEEE 802 committee has produced the 10-gigabit Ethernet standard 802.3ae in
2002.
56
FEATURES COMMON TO ALL ETHERNETS
IEEE 802.3
BROADCASTING
CSMA/CD
BASEBAND TRANSMISSION
FRAME FORMAT
BACKWARD COMPATIBILITY 57
FEATURES VARIATIONS IN ETHERNETS
TOPOLOGY
SPEED
CABLE TYPE
58
Token Ring
Operation
59
Token Ring (802.5)
a) MAC protocol
Small frame (token) circulates when idle
Station waits for token
Changes one bit in token to make it SOF for data
frame
Append rest of data frame
Frame makes round trip and is absorbed by
transmitting station
Station then inserts new token when transmission has
finished and leading edge of returning frame arrives
Under light loads, some inefficiency
Under heavy loads, round robin 60
802.5 Physical Layer
a)Data Rate 4 16 100
b)Medium UTP,STP,Fiber
c) Signaling Differential Manchester
d)Max Frame 4550 18200 18200
61
IEEE 802.2: Logical Link Control
LLC hides the differences between the various kinds of 802 networks by
providing a single format and interface to the network layer.
LLC provides three service options: unreliable datagram service, acknowledged
datagram service, and reliable connection-oriented service.
66
The use of virtual channel sensing using CSMA/CA
A wants to send to B.
C is within range of A.
D is within range of B but not within range of A.
RTS: Request To Send
CTS: Clear To Send.
NAV: Network Allocation Vector
67
A fragment burst
Duration: tells how long the frame and its ack will occupy the channel, which is
used to manage NAV mechanism.
Addresses: Two addresses are used for source and destination, and other two
used for the source and destination base stations for intercell traffic.
Sequence: 12 bits for identifying frame and 4 bits for fragment.
Data: payload up to 2312 bytes.
Management frames are similar to data frames, without one of the base station
addresses because management frames are restricted to a single cell.
Control frames are even shorter, having only one or two addresses, no Data
field, and no Sequence field. Key information is in the Subtype field.
71
802.11 Services
Distribution Services:
Association: used by mobile stations to connect themselves
to base stations.
Disassociation: used by both mobile stations and the base
station to break up their association relationship.
Re-association: used by a mobile station to change its
preferred base station.
Distribution: determine how to route frames sent to the
base station.
Integration: handle the translation from the 802.11 format
to the format required by the non-802.11 destination
network.
72
802.11 Services
Intracell Services (used after association has taken place):
Authentication: used by a mobile station to authenticate
itself (proving it possesses a secret key).
De-authentication: used by a mobile station when leaving
the network
Privacy: manage the encryption and decryption.
Data Delivery: data transmission over 802.11 is not 100%
reliable (the same as Ethernet). Higher layers must deal
with detecting and correcting errors.
73
Broadband Wireless
This section is about wireless local loop or wireless MAN.
Comparison of 802.11 and 802.16:
They were all designed in providing high-bandwidth wireless communication.
802.16 provides service to buildings. Buildings are not mobile (a
simplification). Building can have more than one computer in them (a
complication). Building owners are willing to spend more money for
communication gear than individual notebook owners, so 802.16 can use full-
duplex communication.
802.16 runs over part of a city, covering distance of several kilometers, which
means the perceived power at the base station can vary widely, which affects
signal-to-noise ratio, which, dictates multiple modulation schemes. Open
communication over a city means that security and privacy are essential and
mandatory.
Each 802.16 cell has many more users than an 802.11 cell, forcing 802.16 to
operate in 10-to-66 GHz frequency range, which has different physical
properties and thus requires a different physical layer. Also, error handling is
more important.
802.16 is expected to support telephony and multimedia usage for both
residential and business use.
In short, 802.11 was designed to be mobile Ethernet, whereas 802.16 was
designed to be wireless, but stationary, cable television.
74
The 802.16 Protocol Stack
The 802.16 MAC sublayer uses the base station to manage the channel
allocation. It is connection-oriented in order to provide quality-of-service
guarantees for telephony and multimedia communication.
75
The 802.16 Physical Layer
Service Classes
Constant bit rate service
Real-time variable bit rate service
Non-real-time variable bit rate service
Best efforts service
78
The 802.16 Frame Structure
85
Data Link Layer Switching
LANs can be connected by devices called bridges, which
operate in the data link layer. This means that bridges do not
examine the network layer header and can thus copy IPv4,
IPv6, AppleTalk, ATM, IPX, and OSI packets equally well.
86
Data Link Layer Switching
87
Hubs
and
Switches
88
Bridges
a) Ability to expand beyond single LAN
b) Provide interconnection to other LANs/WANs
c) Use Bridge or router
d) Bridge is simpler
Connects similar LANs
Identical protocols for physical and link layers
Minimal processing
e) Router more general purpose
Interconnect various LANs and WANs
see later
89
Why Bridge?
a)Reliability
b)Performance
c)Security
d)Geography
e)Org Structure
f)To accommodate load
90
Functions of a Bridge
a) Read all frames transmitted on one LAN and accept those
addressed to any station on the other LAN
b) Using MAC protocol for second LAN, retransmit each frame
c) Do the same the other way round
91
Bridge Operation
92
Bridge Design Aspects
a) No modification to content or format of frame
b) No encapsulation
c) Exact bitwise copy of frame
d) Minimal buffering to meet peak demand
e) Contains routing and address intelligence
Must be able to tell which frames to pass
May be more than one bridge to cross
f) May connect more than two LANs
g) Bridging is transparent to stations
Appears to all stations on multiple LANs as if they
are on one single LAN 93
Bridge Protocol Architecture
a) IEEE 802.1D
b) MAC level
Station address is at this level
c) Bridge does not need LLC layer
It is relaying MAC frames
d) Can pass frame over external comms system
e.g. WAN link
Capture frame
Encapsulate it
Forward it across link
94
Remove encapsulation and forward over LAN link
Connection of Two LANs
95
Fixed Routing
a) Complex large LANs need alternative routes
Load balancing
Fault tolerance
b) Bridge must decide whether to forward frame
c) Bridge must decide which LAN to forward frame on
d) Routing selected for each source-destination pair of LANs
Done in configuration
Usually least hop route
Only changed when topology changes
96
Multiple LANs
97
Spanning Tree
100
Spanning Tree Algorithm
a) Address learning works for tree layout
i.e. no closed loops
b) For any connected graph there is a spanning tree that maintains
connectivity but contains no closed loops
c) Each bridge assigned unique identifier
d) Exchange between bridges to establish spanning tree
101
Loop of Bridges
102
Bridges from 802.x to 802.y
General problems:
1. Different frame formats. Solution: reformatting.
2. Different data rates (802.3z 1Gbps and 802.11b 11Mbps). Solution: buffering.
3. Different maximum frame length (e.g., 802.3 1518 bytes, 802.11 2312 bytes,
802.16 1000 (?) bytes, and 802.15.1 2744 bytes). No solution.
4. Security: 802.11 and 802.16 support encryption but 802.3 does not.
5. Quality of service: 802.11 and 802.16 have but 802.3 does not.
104
Local Internetworking
Multiple LANs connected by transparent bridges do not need any change on their
hardware and software.
Transparent bridges operate in promiscuous mode, accepting every frame transmitted on
all the LANs to which it is attached.
When a frame arrives, a bridge must decide whether to discard or forward it, and
if the latter, on which LAN to put the frame. This decision is made by looking up
the destination address in a big (hash) table inside the bridge.
105
Local Internetworking (2)
A bridge maintains a table of destination addresses as follows:
1. Initially all the hash tables are empty.
2. Every incoming frame for an unknown destination is output on all the LANs to
which the bridge is connected except the one it arrived on (flooding).
3. By looking at the incoming frame's source address (backward learning), a
bridge is able to know which machine is accessible on which LAN, so it make
an entry in its hash table linking the source machine with the incoming LAN.
4. To handle dynamic topologies, whenever a hash table entry is made, the arrival
time of the frame is noted in the entry. The entry time is updated whenever a
frame from the address in that entry arrives.
5. Periodically, a process in the bridge scans the hash table and purges all entries
more than a few minutes old.
Routing procedure:
1. If destination and source LANs are the same, discard the frame.
2. If the destination and source LANs are different, forward the frame.
3. If the destination LAN is unknown, use flooding.
Special purpose VLSI chips exist to do the lookup and update the table entry, all in
a few microsecond. 106
Spanning Tree Bridges
To increase reliability, some sites use two or more bridges in parallel between pairs
of LANs. This arrangement creates loops in the topology.
What happens if a frame with an unknown destination arrives ?
The solution is for the bridges to communicate with each other and overlay the
actual topology with a spanning tree that reaches every LAN.
Large networks can be partitioned into multiple communicating spanning trees.
107
Spanning Tree Bridges (2)
(a) A hub. Different from repeater, hubs do not amplify the incoming signals and
are designed to hold multiple line cards each with multiple inputs (one
collision domain). Like repeater, hubs do not examine the 802 addresses or
use them in any way.
(b) A bridge. A bridge has line cards (like a hub) for different network types and
speeds. However, each line is its own collision domain, in contrast to a hub.
(c) A switch. A switch is similar to bridge in its routing on frame addresses, but
is often used to connect individual computers (no collision).
111
Configure LANs logically rather than physically
a) Four physical LANs organized into two VLANs, gray and white, by two
VLAN-aware bridges. A VLAN-aware bridge maintains configuration
tables which tell which VLANs are accessible via which lines.
b) The same 15 machines organized into two VLANs by VLAN-aware
switches.
113
The IEEE 802.1Q Standard