You are on page 1of 119

Lecture notes

Wireless Techniques by Jorma Kekalainen

Wireless Techniques
Jorma Kekalainen

117

Wireless Techniques
Chapter 2: Link Layer and Multiple
Access

118

Link Layer and Multiple Access

Page 1

Lecture notes

Wireless Techniques by Jorma Kekalainen

Layered network model


Networks are complex
many pieces:
hosts
routers
links of various media
applications
protocols
hardware, software

Layers
We can construct a
network as a layered
structure so that each
layer implements a
service
via its own internallayer actions and
relying on services
provided by layer below

119

Why layering?
Dealing with complex systems:
explicit structure allows identification and detection of
relationships inside of the complex system
modularization eases maintenance and updating of system
change of implementation of layers service transparent
to rest of system
e.g., change in some layer procedure doesnt affect rest
of system

layered reference model is useful

120

Link Layer and Multiple Access

Page 2

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: Internet protocol stack


application: supporting network
applications
FTP, SMTP, HTTP

transport: process-process data


transfer
TCP, UDP

network: routing of datagrams from


source to destination

application
transport
network
link

IP, routing protocols

link: data transfer between


neighboring network elements

physical

PPP, Ethernet

physical: bits on the wire or on the


air

121

Some previous protocols

TCP - Transmission Control Protocol


TCP is a reliable protocol used by the majority of applications
on the Internet .
It provides a connection-oriented, full-duplex, point to point
service between hosts.
In addition, flow control is provided which prevents TCP
endpoints from sending data to the network if the network is
experiencing congestion.
UDP - User Datagram Protocol
UDP is a standard, connectionless, host-to-host protocol.
UDP is typically used for real time applications.
IP - Internet Protocol
IP provides a connectionless datagram service between
networks.
IP Datagram can be defined as the fundamental unit of
information which is passed across the Internet.
It contains header information such as the source and
destination addresses along with the payload data.
PPP - Point to Point Protocol
The Point to Point Protocol was designed to provide router to
router and host to network connections

122
Hypertext Transport Protocol (HTTP) is the standard protocol for the carriage of data around an internet
SMTP - Simple Mail Transfer Protocol

Link Layer and Multiple Access

Page 3

Lecture notes

Wireless Techniques by Jorma Kekalainen

ISO/OSI reference model


presentation: allow applications to
interpret meaning of data, e.g.,
encryption, compression, machinespecific conventions
session: synchronization,
checkpointing, recovery of data
exchange
Internet stack miss out these
layers
these services, if needed, must
be implemented in application

application
presentation
session
transport
network
link
physical

123

source
message
segment Ht

datagram Hn Ht
frame Hl Hn Ht

Encapsulation

application
transport
network
link
physical

link
physical
switch

destination
M
Ht

Hn Ht

Hl Hn Ht

application
transport
network
link
physical

Hn Ht

Hl Hn Ht

network
link
physical

Hn Ht

router

124

Link Layer and Multiple Access

Page 4

Lecture notes

Wireless Techniques by Jorma Kekalainen

(Data) Link Layer

125

Data Link Layer


The responsibilities of the data link layer are

framing,
addressing,
flow control,
error control, and
media access control.

The data link layer divides the stream of bits


received from the network layer into manageable data
units called frames.
The data link layer adds a header to the frame to
define the addresses of the sender and receiver of
the frame.
If the rate at which the data are absorbed by the
receiver is less than the rate at which data are
produced in the sender, the data link layer imposes a
flow control mechanism to avoid overwhelming the
receiver.
126

Link Layer and Multiple Access

Page 5

Lecture notes

Wireless Techniques by Jorma Kekalainen

Data Link Layer


The data link layer also adds reliability to the
physical layer by adding mechanisms to detect and
retransmit
damaged,
duplicate, or
lost frames

Error control = error detection and error correction


When two or more devices are connected to the same
link (multiple access), data link layer protocols are
necessary to determine which device has control over
the link at any given time.
127

Link Layer: Introduction


Some terminology:

hosts and routers are nodes


communication channels that connect
adjacent nodes along communication path
are links
wired links
wireless links
LANs

layer-2 packet is a frame, encapsulates


datagram
datagram is transferred by link protocols
over different links:
e.g., Ethernet on first link, frame relay on
intermediate links, 802.11 on last wireless
link

each link protocol provides different


services
e.g., may or may not provide reliable data
transfer over link

data-link layer has responsibility of


transferring datagram from one node
128
to adjacent node over a link

Link Layer and Multiple Access

Page 6

Lecture notes

Wireless Techniques by Jorma Kekalainen

Services
framing, link access:
encapsulate datagram into frame, adding header, trailer
channel access if shared medium
MAC addresses used in frame headers to identify
source, destination
different from IP address

reliable delivery between adjacent nodes


seldom used on low bit-error link (fiber, some twisted
pair)
wireless links: high error rates
Q: why both link-level and end-end reliability?
A: just to make sure? Wasted resources?
129

Services
flow control:
pacing between adjacent sending and receiving nodes

error detection:
errors caused by signal attenuation, noise and distortion.
receiver detects presence of errors:
signals to the sender for retransmission or drops frame

error correction:
receiver identifies (detects) and corrects bit error(s)
without resorting to retransmission

half-duplex and full-duplex


with half-duplex, nodes at both ends of link can transmit, but
not at same time

130

Link Layer and Multiple Access

Page 7

Lecture notes

Wireless Techniques by Jorma Kekalainen

Flow control and error control


The most important responsibilities of the data link
layer are flow control and error control.
Collectively, these functions are known as data link
control.
Flow control is the regulation of the senders data
rate so that the receiver buffer does not become
overwhelmed
control senders sending rate
sender wont overrun receivers buffers by transmitting too
much, too fast

Error control is both error detection and error


correction.
In simply Stop-and-Wait ARQ (Automatic Repeat
reQuest), the sender sends a frame and waits for an
acknowledgment from the receiver before sending
the next frame.

131

Note

Flow control refers to a set of procedures


used to restrict the amount of data
that the sender can send before
waiting for acknowledgment.

132

Link Layer and Multiple Access

Page 8

Lecture notes

Wireless Techniques by Jorma Kekalainen

Accuracy of transmission
Networks must be able to transfer data from one
device to another with acceptable accuracy.
Some applications require that errors are detected
and corrected.
Some applications can tolerate a small level of error.
For example, random errors in audio or video
transmissions may be tolerable, but when we transfer
text, we expect a very high level of accuracy.

133

Error control
reliable point-point communication
generic problem: app-to-app, over path, over link

error model
bits flipped in packet
packets lost
packets reordered

134

Link Layer and Multiple Access

Page 9

Lecture notes

Wireless Techniques by Jorma Kekalainen

Recovering from lost packets


why are packets lost?
limited storage, discarded in congestion
outages: eventually reroute around failure (~sec
recovery times hopefully)
dropped at end system e.g., on NIC

two broad approaches


Automatic Repeat reQuest (ARQ)
Forward error correction (FEC)

Note: Network interface controller, electronic hardware such as a Network Interface


Card (NIC) or Ethernet Adapter that enables a computer to communicate over a 135
computer network.

Automatic Repeat reQuest (ARQ)


sender puts sequence numbers on packets
receiver positively or negatively
acknowledges correct receipt of packet
sender starts timer for each packet,
timeout and retransmits

136

Link Layer and Multiple Access

Page 10

Lecture notes

Wireless Techniques by Jorma Kekalainen

Forward error control


add redundancy to recover from losses
original file (n blocks)
encoding
encoded number of blocks
lossy channel
receive n(1+) blocks
decoding
recover file
137

Redundancy
The central concept in detecting or
correcting errors is redundancy.
To be able to detect or correct errors, we
need to send some extra bits with our data.
These redundant bits are added by the
sender and removed by the receiver.
Their presence allows the receiver to detect
or correct corrupted bits.

138

Link Layer and Multiple Access

Page 11

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

To detect or correct errors, we need to


send extra (redundant) bits with data.

139

Detection vs. Correction


The correction of errors is much more difficult than the
detection.
In error detection, we are looking only to see if any error has
occurred.
The answer is a simple yes or no.
In error correction, we need to know the exact number of
corrupted bits and their location in the message.
The number of the errors and the size of the message are
important factors.
If we need to correct one single error in an 8-bit data unit, we need
to consider eight possible error locations
If we need to correct two errors in a data unit of the same size, we
need to consider 28 possibilities and etc.

We can imagine the receivers difficulty in finding 100 errors in


a data block of 10000 bits.
140

Link Layer and Multiple Access

Page 12

Lecture notes

Wireless Techniques by Jorma Kekalainen

Forward Error Correction (FEC) vs.


retransmission
There are two main methods of error correction.
Forward error correction is the process in which the
receiver tries to guess the message by using
redundant bits.
This is possible, if the number of errors is small.
Correction by retransmission is a technique in which
the receiver detects the occurrence of an error and
asks the sender to resend the message.
Resending is repeated until that the receiver believes
that the message is error-free, i.e., the receiver
dont detect error.
141

Coding
Redundancy is achieved through various coding
schemes.
The sender generates and adds redundant bits
through a process that creates a relationship
between the redundant bits and the actual data
bits.
The receiver generates its own redundant bits and
checks the relationships between the two sets of
bits to detect or correct the errors.
The ratio of redundant bits to the data bits are
important factors in any coding scheme.
There are two broad categories of coding schemes:
block coding and
convolution coding.
142

Link Layer and Multiple Access

Page 13

Lecture notes

Wireless Techniques by Jorma Kekalainen

General idea of coding

143

Example: Process of error detection in


block coding

The sender creates codewords out of datawords by using a generator that applies
the rules and procedures of encoding. Each codeword sent to the receiver may
change during transmission. If the received codeword is the same as one of the
valid codewords, the word is accepted; the corresponding dataword is extracted
from codeword for use. If the received codeword is not valid, it is discarded.
144
However, if the codeword is corrupted during transmission but the received word
still matches a valid codeword, the error remains undetected.

Link Layer and Multiple Access

Page 14

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

An error-detecting code can detect


only the types of errors for which it is
designed; other types of errors may
remain undetected.

145

Example: Process of error correction in


block coding

In error detection, the receiver needs to know only that the received codeword is
invalid; in error correction the receiver needs to find (or guess) the original
codeword sent. More redundant bits for error correction are needed than for
error detection. The idea is the same as error detection but the checker functions
146
are much more complex.

Link Layer and Multiple Access

Page 15

Lecture notes

Wireless Techniques by Jorma Kekalainen

Error control
Errors can be categorized as a single-bit error or a burst error.
A single-bit error has one bit error per data unit.
A burst error has two or more bit errors per data unit.

Redundancy is the concept of sending extra bits for use in error


detection.
Three common and simple redundancy methods are parity check,
cyclic redundancy check (CRC), and checksum.
An extra bit (parity bit) is added to the data unit in the parity
check.
In the two-dimensional parity check, a redundant data unit follows n
data units.
CRC, a powerful redundancy checking technique, appends a sequence
of redundant bits derived from binary division to the data unit.
A checksum is calculated and added to the data block

Main rule: The more error to detect or correct the more


redundancy is needed.
Errors are corrected through retransmission and by forward
error correction.

147

Note

Simply error control in the data link


layer is based on automatic repeat
request (ARQ), which is the
retransmission of data.

148

Link Layer and Multiple Access

Page 16

Lecture notes

Wireless Techniques by Jorma Kekalainen

Error detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields
Error detection is not 100% reliable!
protocol may miss some errors, but rarely
larger EDC field yields better detection and correction

otherwise

149

Example: Checksum
Goal: detect errors in transmitted packet

Sender:
compute checksum of
segment
put checksum value into
checksum field

Receiver:
compute checksum of
received segment
check if computed checksum
equals checksum field value:
NO - error detected
YES - no error detected.
But maybe errors
nonetheless? Yes, maybe
so!

Note: In the Internet the checksum is used by several protocols although not150
at
the data link layer.

Link Layer and Multiple Access

Page 17

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: Parity checking


Single Bit Parity:
Detect single bit errors

Two Dimensional Bit Parity:


Detect and correct single bit errors

The parity check can


detect only an odd number
of errors; it cannot detect
an even number of errors.

Simple form of forward


error correction (FEC)

151

Example: Cyclic Redundancy


Check

view data bits, D, as a binary number


choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that

<D,R> exactly divisible by G (modulo 2)


receiver knows G, divides <D,R> by G. If non-zero remainder
error detected
can detect all burst errors less than r+1 bits

widely used in practice (Ethernet, 802.11 Wi-Fi, ATM)

ATM Asynchronous Transfer Mode creates a fixed channel, or path, between two points
whenever data transfer begins. This differs from TCP/IP , in which messages are divided into
packets and each packet can take a different route from source to destination. This
152
difference makes it easier to track and bill data usage across an ATM network, but it makes
it less adaptable to sudden surges in network traffic.

Link Layer and Multiple Access

Page 18

Lecture notes

Wireless Techniques by Jorma Kekalainen

CRC example
Wanted: Remainder
if we divide D.2r
by G, we get
remainder R

R = remainder[

D.2r
G

153

Example: CRC encoder

The dataword has k bits (4 here); the codeword has n bits (7 here). The size of the dataword
is augmented by adding n - k (3 here) zeros to the right-hand side of the word. The n-bit
result is fed into the generator. The generator uses a divisor of size n - k + 1 (4 here). The
generator divides the augmented dataword by the divisor (modulo-2 division). The quotient of
154the
the division is discarded; the remainder (r2r1 r0) is appended to the dataword to create
codeword.

Link Layer and Multiple Access

Page 19

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: CRC decoder

The decoder receives the possibly corrupted codeword. A copy of all n bits is fed to the
checker which is a replica of the generator. The remainder produced by the checker is a
syndrome of n - k (3 here) bits, which is fed to the decision logic analyzer. The analyzer
has a simple function: If the syndrome bits are all 0s, the 4 leftmost bits of the codeword
are accepted as the dataword (interpreted as no error); otherwise, the 4 bits are 155
discarded (error).

Division in CRC encoder

156

Link Layer and Multiple Access

Page 20

Lecture notes

Wireless Techniques by Jorma Kekalainen

Detection of error in the CRC decoder

157

Where is the link layer implemented?


in each and every host
link layer implemented in
adapter (aka network
interface card, NIC)
Ethernet card, 802.11 card
implements link, physical
layer

attaches into hosts system


buses
combination of hardware,
software, firmware

host schematic
application
transport
network
link

cpu

memory

controller
link
physical

host
bus

physical
transmission

network adapter
card

Note: Firmware is a term often used in electronic systems and computing to denote the
fixed, usually rather small, programs and/or data structures that internally control various
electronic devices. Higher level software can be changed without replacing
a hardware component, and firmware is typically involved with very basic low-level158
operations without which a device would be completely non-functional.

Link Layer and Multiple Access

Page 21

Lecture notes

Wireless Techniques by Jorma Kekalainen

Adapters communicate
datagram

datagram
controller

controller

receiving host

sending host
datagram

frame

receiving side

sending side:
encapsulates datagram in
frame
adds error checking bits,
flow control, etc.

looks for errors, flow


control, etc
extracts datagram, passes
to upper layer at receiving
side

159

Link Layer
Multiple Access

160

Link Layer and Multiple Access

Page 22

Lecture notes

Wireless Techniques by Jorma Kekalainen

Sublayers of Data Link Layer

If we have a dedicated link (or channel) between the sender and the
receiver, then we only need data link control, a mechanism which
provides a link with reliable communication.
On the other hand, if we use e.g. our cellular phone to connect to
another phone, the channel is not dedicated and we need some method
to resolve access to the shared media
We can consider the data link layer as two sublayers.
The upper sublayer is responsible for data link control, and
the lower sublayer is responsible for resolving access to the shared media.

If the channel is dedicated, we do not need the lower sublayer.

Multiple-access control
161

LLC and MAC


The upper sublayer that is responsible for
flow and error control is called the logical link
control (LLC) layer.
The lower sublayer that is mostly responsible
for multiple-access resolution is called the
media access control (MAC) layer.
When nodes or stations are connected and use a
common link, called a multipoint or broadcast link,
we need a multiple-access protocol to coordinate
access to the link.
162

Link Layer and Multiple Access

Page 23

Lecture notes

Wireless Techniques by Jorma Kekalainen

Medium Access Control (MAC)


MAC: Different nodes must gain access to the shared
medium (for instance a wireless channel) in a
controlled fashion (otherwise there will be collisions).
Some access methods:
FDMA

Assigning channels in frequency domain

TDMA

Assigning time slots in time domain

CDMA

Assigning code sequences in code domain

CSMA

Assigning transmission opportunities in


time domain on a statistical basis

:
LLC
MAC
PHY

163

Access problem
The problem of controlling the access to the
medium is similar to the rules of speaking in an
assembly.
The procedures guarantee that the right to speak is
upheld and ensure that two people do not speak at the
same time, do not interrupt each other, do not
monopolize the discussion, and so on.
The situation is similar for multipoint networks.
Many formal protocols have been designed to handle
access to a shared link.

164

Link Layer and Multiple Access

Page 24

Lecture notes

Wireless Techniques by Jorma Kekalainen

Multiple access links and protocols


Two types of links:
point-to-point
PPP for dial-up access
point-to-point link between Ethernet switch and host

broadcast (shared wire or wireless medium)


Ethernet
802.11 wireless LAN

shared wire (e.g.,


cabled Ethernet)

shared RF
(e.g., 802.11 WiFi)

shared RF
(satellite)

Students at a
classroom
(shared air, acoustical)
165

Multiple access protocols


single shared broadcast channel
two or more simultaneous transmissions by nodes:
interference
collision if node receives two or more signals at the same time

multiple access protocol


distributed algorithm that determines how nodes
share channel, i.e., algorithm determines when node
can transmit
communication about channel sharing must use channel
itself!
no out-of-band channel for coordination
166

Link Layer and Multiple Access

Page 25

Lecture notes

Wireless Techniques by Jorma Kekalainen

Ideal multiple access protocol


Broadcast channel of rate R bps
1. when one node wants to transmit, it can send at rate
R.
2. when M nodes want to transmit, each can send at
average rate R/M
3. fully decentralized:
no special node to coordinate transmissions
no synchronization of clocks

4. simple

167

MAC protocols: a taxonomy


We categorize them into three groups :
Channel partitioning or channelization protocols
divide channel into smaller pieces (time slots,
frequency, code)
allocate piece to node for exclusive use

Random access protocols


channel not divided, allow collisions
recover from collisions

Controlled access or taking turns protocols


nodes take turns, but nodes with more to send can take
longer turns

168

Link Layer and Multiple Access

Page 26

Lecture notes

Wireless Techniques by Jorma Kekalainen

Taxonomy of multiple-access protocols

169

Channelization (Channel
partitioning)
Channelization is a multiple-access method in
which the available bandwidth of a link is
shared in time, frequency, or through code,
between different stations.
In this section, we discuss three channelization
protocols: FDMA, TDMA, and CDMA.

170

Link Layer and Multiple Access

Page 27

Lecture notes

Wireless Techniques by Jorma Kekalainen

Analogy
An analogy to the problem of multiple access
is a room (channel) in which people wish to
communicate with each other.
To avoid confusion, people could take turns
speaking (time division), speak at different
pitches (frequency division), or speak in
different languages (code division).

171

Frequency-Division Multiple Access


(FDMA)
In Frequency-Division Multiple Access (FDMA), the
available bandwidth is divided into frequency bands.
Each station is allocated a band to send its data.
In other words, each band is reserved for a specific
station, and it belongs to the station all the time.
Each station also uses a bandpass filter to bound the
transmitter frequencies.
To prevent station interferences, the allocated bands
are separated from one another by small guard bands.

172

Link Layer and Multiple Access

Page 28

Lecture notes

Wireless Techniques by Jorma Kekalainen

Frequency-Division Multiple Access


(FDMA)

173

FDMA

FDM cable

frequency bands

channel spectrum divided into frequency bands


each station assigned fixed frequency band
unused transmission time in frequency bands go idle
example: 6-station LAN, 1,3,4 have packet, frequency
bands 2,5,6 idle

174

Link Layer and Multiple Access

Page 29

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

In FDMA, the available bandwidth


of the common channel is divided into
bands that are separated by guard
bands.

175

Time-Division Multiple Access


(TDMA)
In time-division multiple access (TDMA), the
stations share the bandwidth of the channel
in time.
Each station is allocated a time slot during
which it can send data.
Each station transmits its data in assigned
time slot.

176

Link Layer and Multiple Access

Page 30

Lecture notes

Wireless Techniques by Jorma Kekalainen

Time-Division Multiple Access (TDMA)

177

Channel Partitioning MAC protocols: TDMA


access to channel in "rounds"
each station gets fixed length slot (length = single
packet can be transmitted during a slot time) in
each round
unused slots go idle
example: 6-station LAN, 1,3,4 have packet, slots
2,5,6 idle
6-slot
frame
1

178

Link Layer and Multiple Access

Page 31

Lecture notes

Wireless Techniques by Jorma Kekalainen

Synchronization
The main problem with TDMA lies in achieving
synchronization between the different stations.
Each station needs to know the beginning of its slot
and the location of its slot.
This may be difficult because of propagation delays
introduced in the system if the stations are spread
over a large area.
To compensate for the delays, we can insert guard
times.
Synchronization is normally accomplished by having
some synchronization bits (normally referred to as
preamble bits) at the beginning of each slot.
179

Note

In TDMA, the whole bandwidth is just


one channel that is timeshared between
different stations.

180

Link Layer and Multiple Access

Page 32

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note: TDMA vs. TDM


We also need to emphasize that although TDMA and
TDM conceptually seem the same, there are
differences between them.
TDM is a physical layer technique that combines the
data from slower channels and transmits them by
using a faster channel.
The process uses a physical multiplexer that
interleaves data units from each channel.
TDMA, on the other hand, is an access method in the
data link layer.
The data link layer in each station tells its physical
layer to use the allocated time slot.
181

Code Division Multiple Access (CDMA)


Code division multiple access (CDMA) is a channel
access method utilized by various radio
communication.
CDMA employs spread-spectrum technology and a
special coding scheme (where each transmitter is
assigned a code) to allow multiple users to be
multiplexed over the same physical channel.
CDMA is a form of spread-spectrum signaling, since
the modulated coded signal has a much higher
bandwidth than the data being communicated.

182

Link Layer and Multiple Access

Page 33

Lecture notes

Wireless Techniques by Jorma Kekalainen

Code Division Multiple Access (CDMA)


When hosts communicate over a shared medium, a
protocol is needed so that the signals sent by
multiple senders do not interfere at the receivers.
Medium access protocols can be classified:
channelization or channel partitioning,
random access, and
controlled access or taking turns.

Code division multiple access (CDMA) belongs to the


family of channelization or channel partitioning
protocols.
CDMA and its modifications are common in wireless
LAN and cellular technologies.
183

Spread Spectrum
What can be gained from apparent waste
of spectrum?
Immunity from various kinds of noise and
multipath distortion
Can be used for hiding and encrypting signals
Several users can independently use the same
higher bandwidth with very little interference

184

Link Layer and Multiple Access

Page 34

Lecture notes

Wireless Techniques by Jorma Kekalainen

Code-Division Multiple Access (CDMA)


Code-division multiple access (CDMA) was
invented several decades ago.
Recent advances in electronics have finally
made its implementation possible.
CDMA differs from FDMA because only one
channel occupies the entire bandwidth of
the link.
It differs from TDMA because all stations
can send data simultaneously; there is no
timesharing.
185

Spread-spectrum multiple access

The origins of spread spectrum are in military field and navigation


systems.
Techniques developed to counteract intentional jamming have also
proved suitable for communication through dispersive channels in
cellular applications.
In CDMA each user is assigned a unique code sequence it uses to encode
its information-bearing signal.
The receiver, knowing the code sequences of the user, decodes a
received signal after reception and recovers the original data.
This is possible since the cross-correlations between the code of the
desired user and the codes of the other users are small.
Since the bandwidth of the code signal is chosen to be much larger than
the bandwidth of the information-bearing signal, the encoding process
enlarges (spreads) the spectrum of the signal and is therefore also
known as spread-spectrum modulation.
The resulting signal is also called a spread-spectrum signal, and CDMA is
often denoted as spread-spectrum multiple access (SSMA).

Definition of cross-correlation function:

Link Layer and Multiple Access

Rxy (k ) = lim

1
N N

N 1

x
n=0

yn k

186

Page 35

Lecture notes

Wireless Techniques by Jorma Kekalainen

Classroom analogy
CDMA simply means communication with different codes.
For example, in a classroom with many students, two students
can talk in Finnish if nobody else understands Finnish.
Another two people can talk in Russian if they are the only ones
who understand Russian, and so on.
In other words, the common channel, the space of the classroom
in this case, can easily allow communication between several
couples, but in different languages (codes).
In such circumstances humans are actually quite good at locking
into the conversation in the language they understand, while
filtering out the remaining conversations
A CDMA protocol is similar to having students speaking in
multiple languages

In radio CDMA, each group of users is given a


shared code. Many codes occupy the same channel,
but only users associated with a particular code can
understand each other.

Students at a classroom
(shared air, acoustical)
187

Correlation

Each user in a CDMA system uses a different code to modulate their


signal.
Choosing the codes used to modulate the signal is very important in the
performance of CDMA systems.
The best performance will occur when there is good separation between
the signal of a desired user and the signals of other users.
The separation of the signals is made by correlating the received signal
with the locally generated code of the desired user.
If the signal matches the desired user's code then the value of
correlation function will be high and the system can extract that signal.
If the desired user's code has nothing in common with the signal the
correlation should be as close to zero as possible (thus eliminating the
signal).
If the code is correlated with the signal at any time offset other than
zero, the correlation should be as close to zero as possible.
This is used to reject multi-path interference (operation is referred to
as auto-correlation).
188

Link Layer and Multiple Access

Page 36

Lecture notes

Wireless Techniques by Jorma Kekalainen

Synchronous CDMA

In general, CDMA belongs to two basic categories: synchronous


(orthogonal codes) and asynchronous (pseudorandom codes).
Synchronous CDMA exploits mathematical properties of orthogonality
between vectors representing the data strings.
For example, binary string "1011" is represented by the vector (1, 0, 1, 1).

Vectors can be multiplied by taking their dot product, by summing the


products of their respective components.

If the dot product is zero, the two vectors are said to be orthogonal to
each other
If vectors a and b are orthogonal, then

Example: if u=(a,b) and v=(c,d), the dot product uv = a*c + b*d.

189

Synchronous CDMA
Each user in synchronous CDMA uses a code
orthogonal to the other users' codes to
modulate their signal.
Orthogonal codes have a cross-correlation
equal to zero; in other words, they do not
interfere with each other.
E.g. 64 bit Walsh codes are used to encode the
signal to separate different users.
Since each of the 64 Walsh codes are orthogonal
to one another, the signals are channelized into 64
orthogonal signals.
190

Link Layer and Multiple Access

Page 37

Lecture notes

Wireless Techniques by Jorma Kekalainen

Coordination
The set of N Walsh sequences will afford up to N
users, and in general, an NxN Walsh matrix can be
used to multiplex N users.
Multiplexing requires all of the users to be
coordinated so that each transmits their assigned
sequence v (or the complement, -v) so that they
arrive at the receiver at exactly the same time.
Thus, this technique finds use in base-to-mobile
links, where all of the transmissions originate from
the same transmitter and can be perfectly
coordinated.
On the other hand, the mobile-to-base links cannot
be precisely coordinated, particularly due to the
mobility of the handsets, and require a somewhat
different approach.
191

Asynchronous CDMA

Since it is not mathematically possible to create sequences that are


orthogonal for arbitrarily random starting points, unique pseudo-random
or pseudo-noise (PN) sequences are used in Asynchronous CDMA
systems.
A PN code is a binary sequence that appears random but can be
reproduced in a deterministic manner by intended receivers.
These PN codes are used to encode and decode a user's signal in
Asynchronous CDMA in the same manner as the orthogonal codes in
synchronous CDMA.
These PN sequences are statistically uncorrelated, and the sum of a
large number of PN sequences results in Multiple Access Interference
(MAI) that is approximated by a Gaussian noise process.
If all of the users are received with the same power level, then the
variance (the noise power) of the MAI increases in direct proportion to
the number of users.
In other words, unlike synchronous CDMA, the signals of other users
will appear as noise to the signal of interest and interfere slightly with
the desired signal in proportion to number of users.
192

Link Layer and Multiple Access

Page 38

Lecture notes

Wireless Techniques by Jorma Kekalainen

Processing gain

All forms of CDMA use spread spectrum processing gain (spreading


factor) to allow receivers to partially discriminate against unwanted
signals.
Signals encoded with the specified PN sequence (code) are received,
while signals with different codes (or the same code but a different
timing offset) appear as wideband noise reduced by the process gain.
Since each user generates MAI (Multiple Access Interference) ,
controlling the signal strength is an important issue with CDMA
transmitters.
A Synchronous CDMA, TDMA or FDMA receiver can in theory
completely reject arbitrarily strong signals using different codes, time
slots or frequency channels due to the orthogonality of these systems.
This is not true for Asynchronous CDMA; rejection of unwanted signals
is only partial.
If any or all of the unwanted signals are much stronger than the
desired signal, they will overwhelm it.
This leads to a general requirement in any Asynchronous CDMA system
to approximately match the various signal power levels as seen at the
receiver (Near-far problem).
In CDMA cellular, the base station uses a fast closed-loop power
control scheme to tightly control each mobile's transmit power.

193

Advantages of Asynchronous CDMA


1. Efficient Practical Utilization of Fixed Frequency Spectrum
Asynchronous CDMA's main advantage over Synchronous CDMA,
TDMA and FDMA is that it can use the spectrum more
efficiently in mobile telephony applications.
In theory, CDMA, TDMA and FDMA have exactly the same spectral
efficiency but practically, each has its own challenges power
control in the case of CDMA, timing in the case of TDMA, and
frequency generation/filtering in the case of FDMA.
TDMA systems must carefully synchronize the transmission times
of all the users to ensure that they are received in the correct
timeslot and do not cause interference.
Since this cannot be perfectly controlled in a mobile environment, each
timeslot must have a guard-time, which reduces the probability that
users will interfere, but decreases the spectral efficiency.

Similarly, FDMA systems must use a guard-band between adjacent


channels, due to the unpredictable Doppler shift of the signal
spectrum which occurs due to the user's mobility.
The guard-bands will reduce the probability that adjacent channels will
interfere, but decrease the utilization of the spectrum.
194

Link Layer and Multiple Access

Page 39

Lecture notes

Wireless Techniques by Jorma Kekalainen

Advantages of Asynchronous CDMA


2. Flexible Allocation of Resources
Asynchronous CDMA offers a key advantage in the flexible
allocation of resources
i.e. allocation of a PN codes to active users.

In the case of Synchronous CDMA, TDMA and FDMA the


number of simultaneous orthogonal codes, time slots and
frequency slots respectively is fixed hence the capacity in
terms of number of simultaneous users is limited.
These fixed resources (a fixed number of orthogonal codes,
timeslots or frequency bands), which remain underutilized due to
the bursty nature of telephony and packetized data
transmissions.
There is no strict limit to the number of users that can be
supported in an Asynchronous CDMA system, only a practical
limit governed by the desired bit error probability, since the
SIR (Signal to Interference Ratio) varies inversely with the
number of users.
195

Advantages of Asynchronous CDMA

In a bursty traffic environment like mobile telephony, the advantage


afforded by Asynchronous CDMA is that the performance (bit error
rate) is allowed to fluctuate randomly, with an average value
determined by the product of the number of users and the percentage
of utilization.
Suppose there are 2N users that only talk half of the time, then 2N users
can be accommodated with the same average bit error probability as N users
that talk all of the time.

In other words, Asynchronous CDMA is ideally suited to a mobile


network where is large numbers of transmitters and each generate a
relatively small amount of traffic at irregular intervals.
Synchronous CDMA, TDMA and FDMA systems cannot recover the
underutilized resources inherent to bursty traffic due to the fixed
number of orthogonal codes, time slots or frequency channels that can
be assigned to individual transmitters.
For instance, if there are N time slots in a TDMA system and 2N users that
talk half of the time, then half of the time there will be more than N users
needing to use more than N timeslots.
Furthermore, it would require significant overhead to continually allocate/
deallocate the orthogonal code, time-slot or frequency channel resources.
By comparison, Asynchronous CDMA transmitters simply send when they
have something to say, and go off the air when they don't, keeping the same
PN signature sequence as long as they are connected to the system.
196

Link Layer and Multiple Access

Page 40

Lecture notes

Wireless Techniques by Jorma Kekalainen

Spread Spectrum characteristics of


CDMA

Most modulation schemes try to minimize the bandwidth of this signal


since bandwidth is a limited resource.
However, spread spectrum techniques use a transmission bandwidth
that is several orders of magnitude greater than the minimum
required signal bandwidth.
One of the initial reasons for doing this was problematical military
applications including guidance and communication systems.
These systems were designed using spread spectrum because of its
security and resistance to jamming.
Asynchronous CDMA has some level of privacy built in because the
signal is spread using a pseudorandom code; this code makes the spread
spectrum signals appear random or have noise-like properties.
A receiver cannot demodulate this transmission without knowledge of
the pseudorandom sequence used to encode the data.
CDMA is also resistant to jamming.
A jamming signal only has a finite amount of power available to jam the
signal.
The jammer can either spread its energy over the entire bandwidth of the
signal or jam only part of the entire signal.
197

Characteristics of CDMA

CDMA can also effectively reject narrowband interference.


Since narrowband interference affects only a small portion of the
spread spectrum signal, it can easily be removed through notch filtering
without much loss of information.
Convolution encoding and interleaving can be used to assist in recovering
this lost data.
CDMA signals are also resistant to multipath fading.
Since the spread spectrum signal occupies a large bandwidth only a small
portion of this will undergo fading due to multipath at any given time.
Like the narrowband interference this will result in only a small loss of data
and can be overcome.

Another reason that CDMA is resistant to multipath interference is


because the delayed versions of the transmitted pseudorandom codes
will have poor correlation with the original pseudorandom code, and will
thus appear as another user, which is ignored at the receiver.
In other words, as long as the multipath channel induces at least one
chip of delay, the multipath signals will arrive at the receiver such that
they are shifted in time by at least one chip from the intended signal.
The correlation properties of the pseudorandom codes are such that
this slight delay causes the multipath to appear uncorrelated with
the intended signal, and it is thus ignored.
198

A spreading code assigned to each station is also called chip sequence.

Link Layer and Multiple Access

Page 41

Lecture notes

Wireless Techniques by Jorma Kekalainen

Characteristics of CDMA
Some CDMA devices use a rake receiver, which
exploits multipath delay components to improve the
performance of the system.
A rake receiver combines the information from several
correlators, each one tuned to a different path delay,
producing a stronger version of the signal than a simple
receiver with a single correlator tuned to the path delay of
the strongest signal.

Frequency reuse is the ability to reuse the same radio


channel frequency at other cell sites within a cellular
system.
In the FDMA and TDMA systems frequency planning is of
paramount importance.
The frequencies used in different cells need to be planned
carefully in order to ensure that the signals from different
cells do not interfere with each other.
In a CDMA system the same frequency can be used in every
cell because channelization is done using the pseudorandom
199
codes.

Soft handoff
Reusing the same frequency in every cell eliminates the need for
frequency planning in a CDMA system; however, planning of the
different pseudorandom sequences must be done to ensure that
the received signal from one cell does not correlate with the
signal from a nearby cell.
Since adjacent cells use the same frequencies, CDMA systems have
the ability to perform soft handoffs.
Soft handoffs allow the mobile telephone to communicate
simultaneously with two or more cells.

The best signal quality is selected until the handoff is complete.


Signal strength may vary abruptly in a hard handoff situation
utilized in other cellular systems
In CDMA systems use the soft handoff provides a more reliable and
higher quality signal.

200

Link Layer and Multiple Access

Page 42

Lecture notes

Wireless Techniques by Jorma Kekalainen

DSSS - Direct-Sequence SpreadSpectrum


There are basic techniques to spread the bandwidth:
Direct Sequence Spread Spectrum (DSSS) and
Frequency Hopping Spread Spectrum (FHSS).

Direct-sequence spread-spectrum transmissions multiply the


data being transmitted by a "noise" signal.
This noise signal is a pseudorandom sequence of 1 and 1 values,
at a frequency much higher than that of the original signal,
thereby spreading the energy of the original signal into a much
wider band.
The resulting signal resembles white noise.
However, this noise-like signal can be used to exactly
reconstruct the original data at the receiving end, by multiplying
it by the same pseudorandom sequence (because 1 1 = 1, and
1 1 = 1).
This process, known as "de-spreading", mathematically
constitutes a correlation of the transmitted PN sequence with
the PN sequence that the receiver believes the transmitter is
using.
201

DSSS - Direct-Sequence SpreadSpectrum


The resulting effect of enhancing signal to noise ratio
on the channel is called processing gain.
This effect can be made larger by employing a longer
PN sequence and more chips per bit.
If an undesired transmitter transmits on the same
channel but with a different PN sequence (or no
sequence at all), the de-spreading process results in
no processing gain for that signal.
This effect is the basis for the code division multiple
access (CDMA) property of DSSS, which allows
multiple transmitters to share the same channel
within the limits of the cross-correlation properties
of their PN sequences.
202

Link Layer and Multiple Access

Page 43

Lecture notes

Wireless Techniques by Jorma Kekalainen

Frequency Hopping Spread Spectrum (FHSS)


Signal is broadcast over seemingly random series of radio
frequencies
A number of channels allocated for the FH signal
Width of each channel corresponds to bandwidth of input signal

Signal hops from frequency to frequency at fixed intervals


Transmitter operates in one channel at a time
Bits are transmitted using some encoding scheme
At each successive interval, a new carrier frequency is selected

203

Direct-Sequence Multiple Access


Direct Sequence CDMA In DS-CDMA the
modulated information-bearing signal (the
data signal) is directly modulated by a digital
(discrete-time, discrete-valued) code signal.
The data signal can be either analog or digital;
in most cases it is digital.
In the case of a digital signal the data
modulation is often omitted and the data
signal is directly multiplied by the code
signal and the resulting signal modulates the
RF carrier.
204

Link Layer and Multiple Access

Page 44

Lecture notes

Wireless Techniques by Jorma Kekalainen

Idea of spread spectrum

205

Direct Sequence Spread Spectrum


(DSSS)
Each bit in original signal is represented by
multiple bits in the transmitted signal
Spreading code spreads signal across a wider
frequency band
Spread is in direct proportion to number of bits used

One technique combines digital information


stream with the spreading code bit stream
using exclusive-OR

206

Link Layer and Multiple Access

Page 45

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: Direct Sequence Spread


Spectrum

207

Note: Exclusive-OR

DSSS system
Multiply BPSK signal,
sd(t) = A d(t) cos(2 fct)

by c(t) [+1, -1] to get


s(t) = A d(t)c(t) cos(2 fct)
A = amplitude of signal
fc = carrier frequency
d(t) = [+1, -1]

At receiver, incoming
signal multiplied by c(t)
Since, c(t) x c(t) = 1,
incoming signal is
recovered
208

Link Layer and Multiple Access

Page 46

Lecture notes

Wireless Techniques by Jorma Kekalainen

Code-Division Multiple Access


(CDMA)
Basic Principles of CDMA
D = rate of data signal
Break each bit into k chips
Chips are a user-specific fixed pattern

Chip data rate of new channel = kD

209

CDMA Example
If k=6 and code is a sequence of 1s and -1s
For a 1 bit, A sends code as chip pattern
<c1, c2, c3, c4, c5, c6>

For a 0 bit, A sends complement of code


<-c1, -c2, -c3, -c4, -c5, -c6>

Receiver knows senders code and performs


electronic decode function

<d1, d2, d3, d4, d5, d6> = received chip pattern


<c1, c2, c3, c4, c5, c6> = senders code

210

Link Layer and Multiple Access

Page 47

Lecture notes

Wireless Techniques by Jorma Kekalainen

CDMA Example
User A code = <1, 1, 1, 1, 1, 1>
To send a 1 bit = <1, 1, 1, 1, 1, 1>
To send a 0 bit = <1, 1, 1, 1, 1, 1>

User B code = <1, 1, 1, 1, 1, 1>


To send a 1 bit = <1, 1, 1, 1, 1, 1>

Receiver receiving with As code


(As code) x (received chip pattern)
User A 1 bit: 6 -> 1
User A 0 bit: -6 -> 0
User B 1 bit: 0 -> unwanted signal ignored

211

DSSS-CDMA

212

Link Layer and Multiple Access

Page 48

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

In DS-CDMA, one channel carries all


transmissions simultaneously.

213

Spreading and De-spreading


DSSS
10 KHz bandwidth

chip rate (BW)

fc
Transmission

chip rate (BW)

10 KHz bandwidth

fc

Reception

Baseband
Information Bits

Coding
and
Interleaving

Walsh Code
Spread

Walsh Code
Correlator

Deinterleaving
and Decoding

Baseband
Information Bits

9,6 kbps

19,2 kbps

chip rate

chip rate

19,2 kbps

9,6 kbps

-113 dBm (1,23 MHz)

fc
Thermal Noise

Link Layer and Multiple Access

Spurious Signals

fc
External Interference

chip rate (BW)

fc
Interference from other
cells within the system

chip rate (BW)

fc
Interference from users
within the same cell

214

Page 49

Lecture notes

Wireless Techniques by Jorma Kekalainen

CDMA
Receiver for User 1
Transmitter for User 1
m1(t)

m1(t)c1(t)

Wireless
Channel

m1(t)+
m2(t)c1(t)c2(t)

m1(t)+e1(t)

TSym bol

m1(t)

m1(t)c1(t)+
m2(t)c2(t)

c1(t)

Transmitter for User 2


m2(t)

m2(t)c2(t)

c1(t)

Receiver for User 2


m2(t)+
m1(t)c1(t)c2(t)

m2(t)+e2(t)

TSym bol

c2(t)

m2(t)

c2(t)

Important Note:
The value of ei(t) depends on the
cross correlation properties
between c1 & c2
ei(t)=0 if c1 & c2 are orthogonal

mi(t): Information Message of User i


ci(t): Spreading code of user i
ei(t): Interference sensed at
receiver of user i
215
mi(t): Message detected at receiver

Spreading code properties

After the signal is created by the source, the spreading process


uses a spreading code and spreads the bandwidth.

The spreading code is a series of numbers that look random, but


are actually a pattern.

Good CDMA spreading codes should be characterized by


relatively low cross-correlation properties to minimize multiple
access interference (MAI).

Good CDMA spreading codes should be characterized by low


autocorrelation properties to minimize inter-symbol interference
due to multi-path channels

Ideally it is desirable to have both correlation functions to


approach zero

216

Link Layer and Multiple Access

Page 50

Lecture notes

Wireless Techniques by Jorma Kekalainen

Spreading and despreading

BW= BS

BW= GBS

BW= GBS

BW= BS

Data
Symbol

Symbol
Detection

Spreading Code
Signal Spreading

Interference

Spreading Code

Communication
Channel

Signal De-spreading

217

Categories of spreading sequences


Spreading Sequence Categories
PN (pseudorandom) sequences (not perfectly orthogonal)
Orthogonal codes (needs tight synchronization)

For FHSS systems


PN sequences most common

For DSSS systems not employing CDMA


PN sequences most common

For DS-CDMA systems


PN sequences
Orthogonal codes

218

Link Layer and Multiple Access

Page 51

Lecture notes

Wireless Techniques by Jorma Kekalainen

PN Sequences
PN generator produces periodic sequence
that appears to be random
PN Sequences
Generated by an algorithm using initial seed
Sequence is not statistically random but will pass many test
of randomness
Sequences referred to as pseudorandom numbers or
pseudonoise sequences
Unless algorithm and seed are known, the sequence is
impractical to predict

219

M-sequences
A maximum length sequence (MLS or M-sequence) is a type of
pseudorandom binary sequence.
They are bit sequences generated using maximal linear feedback
shift registers and are so called because they are periodic and
reproduce every binary sequence that can be reproduced by the
shift registers (i.e., for length-m registers they produce a
sequence of length N=(2m 1).
Maximum length sequences are spectrally flat, with the
exception of a near-zero DC term.
Practical applications for MLS are used as a basis for deriving
pseudo-random sequences in digital communication systems that
employ direct-sequence spread spectrum and frequency-hopping
spread spectrum transmission systems.

220

Link Layer and Multiple Access

Page 52

Lecture notes

Wireless Techniques by Jorma Kekalainen

Binary linear feedback shift register


sequence generator

221

Important PN Properties
Randomness
Uniform distribution
Independence
Correlation property
The periodic autocorrelation of a 1 m-sequence is

1
R ( ) = 1

= 0, N, 2N, ...
otherwise

Where N=2m-1 is sequence length of m-stage register


Maximal length sequences are not perfectly orthogonal
Maximal length sequences have good auto-correlation properties

Unpredictability

Link Layer and Multiple Access

222

Page 53

Lecture notes

Wireless Techniques by Jorma Kekalainen

Definitions
Correlation
The concept of determining how much similarity or
resemblance one set of data has with another
Range between 1 and 1
1 The second sequence matches the first sequence
0 There is no relation at all between the two sequences
-1 The two sequences are mirror images

Cross correlation
The comparison between two sequences from
different sources rather than a shifted copy of a
sequence with itself

223

Advantages of M-sequences
The cross correlation between an M-sequence
and noise is low
This property is useful to the receiver in filtering out noise

The cross correlation between two different


M-sequences is low
This property is useful for CDMA applications
Enables a receiver to discriminate among spread spectrum
signals generated by different m-sequences

224

Link Layer and Multiple Access

Page 54

Lecture notes

Wireless Techniques by Jorma Kekalainen

Gold sequences
Gold sequences constructed by the XOR of
two m-sequences with the same clocking
Codes have well-defined cross correlation
properties
Only simple circuitry needed to generate
large number of unique codes
In following example two shift registers
generate the two m-sequences and these are
then bitwise XORed
A Gold code (Gold sequence, named after R. Gold), is a type of binary 225
sequence, used in telecommunication (CDMA) and satellite navigation (GPS).

Gold Sequences

Shift-register implementation

Link Layer and Multiple Access

226

Page 55

Lecture notes

Wireless Techniques by Jorma Kekalainen

Orthogonal Codes
Orthogonal codes
All pairwise cross-correlations are zero
Fixed- and variable-length codes used in CDMA
systems
For CDMA application, each mobile user uses one
sequence in the set as a spreading code
Provides zero cross-correlation among all users

Types
Walsh codes
Variable-Length orthogonal codes
A Walsh matrix (proposed by J.L. Walsh) is a specific square matrix, with
dimensions a power of 2, the entries of which are +1 or 1, and the property that
the dot product of any two distinct rows (or columns) is zero. The Walsh matrix
(and Walsh functions) are used in computing the Walsh transform and have 227
applications in the efficient implementation of certain signal processing operations.

Chipping sequence
In a CDMA protocol, each bit being sent is encoded by
multiplying the bit by a signal or spreading code (the chipping
sequence) that changes at a much faster rate (known as the
chipping rate) than the original sequence of data bits.
Suppose that the rate at which original data bits reach the
CDMA encoder defines the unit of time; that is, each original
data bit to be transmitted requires a one-bit slot time.
Let di be the value of the data bit for the ith bit slot.
For mathematical convenience, we represent a data bit with a 0
value as -1.
Each bit slot is further subdivided into M mini-slots.
The CDMA code used by the sender consists of a sequence of M
values, cm, m = 1, . . . ,M, each taking a +1 or -1 value.

228

Link Layer and Multiple Access

Page 56

Lecture notes

Wireless Techniques by Jorma Kekalainen

Output of the encoder


To illustrate how CDMA works, let us focus on
the ith data bit, di.
For the mth mini-slot of the bit-transmission
time of di, the output of the CDMA encoder
Zi,m, is the value of di, multiplied by the mth
bit in the assigned CDMA code, cm:
(1)

229

Output of the decoder


In an ideal case, with no interfering senders,
the receiver would receive the encoded bits,
Zi,m and recover the original data bit, di, by
simply computing:
(2)

230

Link Layer and Multiple Access

Page 57

Lecture notes

Wireless Techniques by Jorma Kekalainen

Additive signals
The real world is far from ideal, however, CDMA must
work in the presence of interfering senders that are
encoding and transmitting their data using a
different assigned code.
But how can a CDMA receiver recover a senders
original data bits when those data bits are being in a
mess with bits being transmitted by other senders?
CDMA works under the assumption that the
interfering transmitted bit signals are additive.
This means, for example, that if three senders send a
1 value, and a fourth sender sends a -1 value during
the same mini-slot, then the received signal at all
receivers during that mini-slot is a 2 (since 1 + 1 + 1 1 = 2).
231

Multiple senders
In the presence of multiple senders, sender s
computes its encoded transmissions, Zsi,m in
exactly the same manner as in Equation (1).
The value received at a receiver during the
mth mini-slot of the ith bit slot, however, is
now the sum of the transmitted bits from all
N senders during that mini-slot:
(3)
232

Link Layer and Multiple Access

Page 58

Lecture notes

Wireless Techniques by Jorma Kekalainen

Code division
If the senders codes are chosen carefully, each receiver can
recover the data sent by a given sender out of the aggregate
signal simply by using the senders code in exactly the same
manner as in Equation (2):
(3)

We see here that CDMA is a partitioning protocol in that it


partitions the codespace (as opposed to time or frequency) and
assigns each node a dedicated piece of the codespace allowing
multiple users to coexist and transmit simultaneously with
minimal interference (if codes are orthogonal).
233

Example: CDMA encode/decode


sender

d0 = 1

data
bits
code

Zi,m= di.cm

-1 -1 -1

1
-1

11 1
-1 -1 -1

slot 1

-1

slot 1
channel
output

1
-1

11 1 11 1

d1 = -1
1 1 1

channel output Zi,m

-1 -1 -1

slot 0

1
-1

-1 -1 -1

slot 0
channel
output

Di = Zi,m.cm
m=1

received
input

-1 -1 -1

code

receiver

1 1 1 1 1 1

1
-1

1 1 1

-1 -1 -1

-1

1
-1

1 1 1
-1 -1 -1

slot 1

1
-1

-1 -1 -1

slot 0

d0 = 1
d1 = -1

slot 1
channel
output

slot 0
channel
output

Here M = 8, although in practice M is much larger. In this example in the


234Mbit CDMA code being used by the sender is (1, 1, 1, -1, 1, -1, -1, -1).

Link Layer and Multiple Access

Page 59

Lecture notes

Wireless Techniques by Jorma Kekalainen

CDMA: two-sender interference

235

CDMA example

236

Link Layer and Multiple Access

Page 60

Lecture notes

Wireless Techniques by Jorma Kekalainen

CDMA example

237

Recap: CDMA
used in several wireless broadcast channels
(cellular, satellite, etc) standards
unique code assigned to each user; i.e., code set
partitioning
all users share same frequency, but each user has
own chipping sequence (i.e., code) to encode data
encoded signal = (original data) X (chipping
sequence)
decoding: inner-product of encoded signal and
chipping sequence
allows multiple users to coexist and transmit
simultaneously with minimal interference (if codes
are orthogonal)
238

Link Layer and Multiple Access

Page 61

Lecture notes

Wireless Techniques by Jorma Kekalainen

Multiple-access protocols

239

Random Access Protocols


When node has packet to send
transmit at full channel data rate R.
no a priori coordination among nodes

Two or more transmitting nodes collision,


Random access MAC protocol specifies:
how to detect collisions
how to recover from collisions (e.g., via delayed
retransmissions)

Examples of random access MAC protocols:


ALOHA
slotted ALOHA
CSMA, CSMA/CD, CSMA/CA
240

CSMA/CA - Carrier Sensing Multiple Access / Collision Avoidance

Link Layer and Multiple Access

Page 62

Lecture notes

Wireless Techniques by Jorma Kekalainen

Random access
In random access or contention methods, no station is superior
to another station and none is assigned the control over
another.
No station permits, or does not permit, another station to send.

At each instance, a station that has data to send uses a


procedure defined by the protocol to make a decision on
whether or not to send.
This decision depends on the state of the medium (idle or busy).

In other words, each station can transmit when it desires on the


condition that it follows the predefined procedure, including the
testing of the state of the medium.

241

Contention
Two features give this method its name.

First, there is no scheduled time for a station to transmit.


Transmission is random among the stations.
That is why these methods are called random access.
Second, no rules specify which station should send next.

Stations compete with one another to access the


medium.
That is why these methods are also called contention
methods.

242

Link Layer and Multiple Access

Page 63

Lecture notes

Wireless Techniques by Jorma Kekalainen

Collision
In a random access method, each station has the
right to the medium without being controlled by any
other station.
However, if more than one station tries to send,
there is an access conflictcollisionand the frames
will be either destroyed or modified.
To avoid access conflict or to resolve it when it
happens, each station follows a procedure that
answers the following questions:
When can the station access the medium?
What can the station do if the medium is busy?
How can the station determine the success or failure of the
transmission?
What can the station do if there is an access conflict?
243

Random access methods


The random access methods we study here have evolved from a
very interesting protocol known as ALOHA, which used a very
simple procedure called multiple access (MA).
The method was improved with the addition of a procedure that
forces the station to sense the medium before transmitting.
This was called carrier sense multiple access (CSMA).
This method later evolved into two parallel methods:
carrier sense multiple access with collision detection (CSMA/CD)
and
carrier sense multiple access with collision avoidance (CSMA/CA).

CSMA/CD tells the station what to do when a collision is


detected.
CSMA/CA tries to avoid the collision.

244

Link Layer and Multiple Access

Page 64

Lecture notes

Wireless Techniques by Jorma Kekalainen

ALOHA
ALOHA, the earliest random access method, was
developed in early 1970.
It was designed for a radio (wireless) LAN, but it can
be used on any shared medium.
It is obvious that there are potential collisions in this
a very simple multiple access arrangement, where the
medium is shared between the stations.
When a station sends data, another station may
attempt to do so at the same time.
The data from the two stations collide and become
corrupted.
245

Pure ALOHA
The original ALOHA protocol is called pure
ALOHA.
This is a simple, but elegant protocol.
The idea is that each station sends a frame
whenever it has a frame to send.
However, since there is only one channel to
share, there is the possibility of collision
between frames from different stations.

246

Link Layer and Multiple Access

Page 65

Lecture notes

Wireless Techniques by Jorma Kekalainen

Pure ALOHA
pure Aloha: simple, no synchronization
when frame arrives
transmit immediately
frame sent at t0 collides with other frames sent in [t0-1,t0+1]

247

Frames in a pure ALOHA network

248

Link Layer and Multiple Access

Page 66

Lecture notes

Wireless Techniques by Jorma Kekalainen

Comment about the foregoing


example
There are four stations that contend with one
another for access to the shared channel.
The Figure shows that each station sends two frames;
there are a total of eight frames on the shared
medium.
Some of these frames collide because multiple
frames are in contention for the shared channel.
Figure shows that only two frames survive: frame 1.1
from station 1 and frame 3.2 from station 3.
Note that even if one bit of a frame coexists on the
channel with one bit from another frame, there is a
collision and both will be destroyed.
249

Acknowledgement

It is obvious that we need to resend the frames that have been


destroyed during transmission.
The pure ALOHA protocol relies on acknowledgement from the
receiver.
When a station sends a frame, it expects the receiver to send an
acknowledgement.
If the acknowledgment does not arrive after a time-out period, the
station assumes that the frame (or the acknowledgement) has been
destroyed and resends the frame.
A collision involves two or more stations.
If all these stations try to resend their frames after the time-out,
the frames will collide again.
Pure ALOHA dictates that when the time-out period passes, each
station waits a random amount of time before resending its frame.
The randomness will help avoid more collisions.
We call this time the back-off time TB.

250

Link Layer and Multiple Access

Page 67

Lecture notes

Wireless Techniques by Jorma Kekalainen

Maximum number of
retransmission
Pure ALOHA has a second method to prevent
congesting the channel with retransmitted
frames.
After a maximum number of retransmission
attempts Kmax, a station must give up and try
later.

251

Procedure for pure ALOHA


protocol

252

Link Layer and Multiple Access

Page 68

Lecture notes

Wireless Techniques by Jorma Kekalainen

Back-off time
The time-out period is equal to the maximum possible roundtrip propagation delay, which is twice the amount of time
required to send a frame between the two most widely
separated stations (2 x Tp).
The back-off time TB is a random value that normally depends
on K (the number of attempted unsuccessful transmissions).
The formula for TB depends on the implementation.
One common formula is the binary exponential back-off.
In this method, for each retransmission, a multiplier in the
range 0 to 2K-1 is randomly chosen and multiplied by TP
(maximum propagation time) or Tfr (the average time required to
send out a frame) to find TB.
Note that in this procedure, the range of the random numbers
increases after each collision.
The value of Kmax is usually chosen as 15.
253

Example
The stations on a wireless ALOHA network are a maximum
of 600 km apart. If we assume that signals propagate at 3
108 m/s, we find the maximum propagation time

Tp = (6 105 ) / (3 108 ) = 2 ms.


Now we can find the value of TB for different values of K .
a. For K = 1, the range 0 to 2K-1 is {0, 1}. The station needs
to generate a random number with a value of 0 or 1. This
means that TB is either 0 ms (0 2) or 2 ms (1 2), based
on the outcome of the random variable.
254

Link Layer and Multiple Access

Page 69

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example (continued)
b. For K = 2, the range is {0, 1, 2, 3}. This means that TB
can be 0, 2, 4, or 6 ms, based on the outcome of the
random variable.

c. For K = 3, the range is {0, 1, 2, 3, 4, 5, 6, 7}. This


means that TB can be 0, 2, 4, . . . , 14 ms, based on the
outcome of the random variable.

255

Vulnerable time
Let us find the length of time, the vulnerable
time, in which there is a possibility of
collision.
We assume that the stations send fixedlength frames with each frame taking Tfr to
send.

256

Link Layer and Multiple Access

Page 70

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: Vulnerable time


Station A sends a frame at time t.
Now imagine station B has already sent a frame between t-Tfr
and t.
This leads to a collision between the frames from station A and
station B.
The end of Bs frame collides with the beginning of As frame.
On the other hand, suppose that station C sends a frame
between t and t + Tfr.
Here, there is a collision between frames from station A and
station C.
The beginning of Cs frame collides with the end of As frame.
Looking at next Figure, we see that the vulnerable time, during
which a collision may occur in pure ALOHA, is 2 times the
frame transmission time.
Pure ALOHA vulnerable time 2
Tfr

257

Vulnerable time for pure ALOHA protocol

Figure shows the vulnerable time for station A

Link Layer and Multiple Access

258

Page 71

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the requirement to
make this frame collision-free?
Solution
Average frame transmission time Tfr is 200 bits/200 kbps
or 1 ms. The vulnerable time is 2Tfr = 2 1 ms = 2 ms. This
means no station should send later than 1 ms before this
station starts transmission and no station should start
sending during the one 1 ms period that this station is
sending.

259

Throughput
Let us call G the average number of frames generated by the
system during one frame transmission time.
Then it can be proved that the average number of successful
transmissions for pure ALOHA is S = G x e-2G.
The maximum throughput Smax is 0.184, for G =.
In other words, if one-half a frame is generated during one
frame transmission time (in other words, one frame during two
frame transmission times), then 18.4 percent of these frames
reach their destination successfully.
This is an expected result because the vulnerable time is 2
times the frame transmission time.
Therefore, if a station generates only one frame in this
vulnerable time (and no other stations generate a frame during
this time), the frame will reach its destination successfully.
260

Link Layer and Multiple Access

Page 72

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

The throughput for pure ALOHA is


S = G e 2G .
The maximum throughput
Smax = 0.184 when G= 1/2.

261

262

Link Layer and Multiple Access

Page 73

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The G is 1. In this case
S = G e2 G or S = 0.135 (13.5 percent). This means
that the throughput is 1000 0.135 = 135 frames. Only
135 frames out of 1000 will on average survive.
263

Example (continued)
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G e 2G or S = 0.184 (18.4 percent). This
means that the throughput is 500 0.184 = 92 and that
only 92 frames out of 500 will on average survive. Note
that this is the maximum throughput case.
c. If the system creates 250 frames per second, this is
(1/4) frame per millisecond. The load is (1/4). In this case
S = G e -2G or S = 0.152 (15.2 percent). This means
that the throughput is 250 0.152 = 38. Only 38
frames out of 250 will on average survive.
264

Link Layer and Multiple Access

Page 74

Lecture notes

Wireless Techniques by Jorma Kekalainen

Pure Aloha efficiency


P(success by given node) = P(node transmits) .
P(no other node transmits in [t0-1,t0] .
P(no other node transmits in [t0,t0+1]
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
choosing optimum p and then letting n -> infinity ...
= 1/(2e) .184

265

Slotted ALOHA
Pure ALOHA has a vulnerable time of 2 x Tfr.
This is so because there is no rule that defines when
the station can send.
A station may send soon after another station has
started or soon before another station has finished.
Slotted ALOHA was invented to improve the
efficiency of pure ALOHA.
In slotted ALOHA we divide the time into slots of
Tfr and force the station to send only at the
beginning of the time slot.
266

Link Layer and Multiple Access

Page 75

Lecture notes

Wireless Techniques by Jorma Kekalainen

Slotted ALOHA
Assumptions:
all frames same size
time divided into equal
size slots (time to
transmit 1 frame)
nodes start to transmit
only slot beginning
nodes are synchronized
if 2 or more nodes
transmit in slot, all
nodes detect collision

Operation:
when node obtains fresh
frame, transmits in next
slot
if no collision: node can
send new frame in next
slot
if collision: node
retransmits frame in
each subsequent slot
with probability p until
success
267

Frames in a slotted ALOHA


network

268

Link Layer and Multiple Access

Page 76

Lecture notes

Wireless Techniques by Jorma Kekalainen

Vulnerable time
Because a station is allowed to send only at the beginning of
the synchronized time slot, if a station misses this moment, it
must wait until the beginning of the next time slot.
This means that the station which started at the beginning of
this slot has already finished sending its frame.
Of course, there is still the possibility of collision if two
stations try to send at the beginning of the same time slot.
However, the vulnerable time is now reduced to one-half, equal
to Tfr
Next Figure shows that the vulnerable time for slotted ALOHA
is one-half that of pure ALOHA.
Slotted ALOHA vulnerable time = Tfr

269

Vulnerable time for slotted ALOHA


protocol

270

Link Layer and Multiple Access

Page 77

Lecture notes

Wireless Techniques by Jorma Kekalainen

Throughput
It can be proved that the average number of
successful transmissions for slotted ALOHA is
S=Ge-G.
The maximum throughput Smax is 0.368, when G = 1.
In other words, if a frame is generated during one
frame transmission time, then 36.8 percent of
these frames reach their destination successfully.
This result can be expected because the vulnerable
time is equal to the frame transmission time.
Therefore, if a station generates only one frame in
this vulnerable time (and no other station generates a
frame during this time), the frame will reach its
destination successfully.
271

Note

The throughput for slotted ALOHA is


S = G eG .
The maximum throughput
Smax = 0.368 when G = 1.

272

Link Layer and Multiple Access

Page 78

Lecture notes

Wireless Techniques by Jorma Kekalainen

273

Example
A slotted ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load G is 1. In this case
S = G eG or S = 0.368 (36.8 percent). This means
that the throughput is 1000 0.368 = 368 frames.
Only 386 frames out of 1000 will probably survive.
274

Link Layer and Multiple Access

Page 79

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example (continued)
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G eG or S = 0.303 (30.3 percent). This
means that the throughput is 500 0.303 = 151.
Only 151 frames out of 500 will probably survive.
c. If the system creates 250 frames per second, this is
(1/4) frame per millisecond. The load is (1/4). In this case
S = G e G or S = 0.195 (19.5 percent). This means
that the throughput is 250 0.195 = 49. Only 49
frames out of 250 will probably survive.

275

Slotted Aloha efficiency


Efficiency : long-run
fraction of successful slots
(many nodes, all with many
frames to send)
suppose: N nodes with
many frames to send,
each transmits in slot
with probability p
probability that given
node has success in a
slot = p(1-p)N-1
probability that any
node has a success =
Np(1-p)N-1

Link Layer and Multiple Access

max efficiency: find


p* that maximizes
Np(1-p)N-1
for many nodes, take
limit of Np*(1-p*)N-1
as N goes to infinity,
gives:
Max efficiency = 1/e .368

At best: channel
used for useful
transmissions 37%
of time!

!
276

Page 80

Lecture notes

Wireless Techniques by Jorma Kekalainen

277

Slotted ALOHA

Pros
single active node can
continuously transmit
at full rate of channel
highly decentralized:
only slots in nodes
need to be in sync
simple

Link Layer and Multiple Access

Cons
collisions, wasting slots
idle slots
nodes may be able to
detect collision in less
than time to transmit
packet
clock synchronization
278

Page 81

Lecture notes

Wireless Techniques by Jorma Kekalainen

Carrier Sense Multiple Access (CSMA)


To minimize the chance of collision and, therefore, increase the
performance, the CSMA method was developed.
The chance of collision can be reduced if a station senses the
medium before trying to use it.
Carrier sense multiple access (CSMA) requires that each station
first listen to the medium (or check the state of the medium)
before sending.
In other words, CSMA is based on the principle sense before
transmit or listen before talk.

CSMA can reduce the possibility of collision, but it cannot


eliminate it.
The possibility of collision still exists because of propagation
delay;
when a station sends a frame, it still takes time (although very
short) for the first bit to reach every station and for every station
to sense it.
In other words, a station may sense the medium and find it idle,
only because the first bit sent by another station has not yet been
received.

Next Figure, a space and time model of a CSMA network, shows


279
this situation.

Space/time model of the collision in


CSMA

280

Link Layer and Multiple Access

Page 82

Lecture notes

Wireless Techniques by Jorma Kekalainen

CSMA (Carrier Sense Multiple Access)


CSMA: listen before transmit:
If channel sensed idle: transmit entire frame
If channel sensed busy, postpone transmission
human analogy: dont interrupt others!

281

CSMA collisions
spatial layout of nodes

collisions can still occur:


because of propagation delay
two nodes may not hear
each others transmission

collision:
entire packet transmission
time wasted

note:
role of distance & propagation
delay in determining collision
probability

282

Link Layer and Multiple Access

Page 83

Lecture notes

Wireless Techniques by Jorma Kekalainen

Vulnerable time
The vulnerable time for CSMA is the propagation
time Tp.
This is the time needed for a signal to propagate
from one end of the medium to the other.
When a station sends a frame, and any other station
tries to send a frame during this time, a collision will
result.
But if the first bit of the frame reaches the end of
the medium, every station will already have heard the
bit and will refrain from sending.
Next Figure shows the worst case:
The leftmost station A sends a frame at time t1, which
reaches the rightmost station D at time t1 + Tp.
The gray area shows the vulnerable area in time and space.
283

Vulnerable time in CSMA

284

Link Layer and Multiple Access

Page 84

Lecture notes

Wireless Techniques by Jorma Kekalainen

Persistence methods
What should a station do if the channel is busy?
What should a station do if the channel is idle?
Three methods have been devised to answer these
questions:
the 1-persistent method,
the non-persistent method, and
the p-persistent method.

Next Figure shows the behavior of three persistence


methods when a station finds a channel busy.

285

Behavior of three persistence methods

286

Link Layer and Multiple Access

Page 85

Lecture notes

Wireless Techniques by Jorma Kekalainen

1-Persistent
The 1-persistent method is
simple and straightforward.
In this method, after the
station finds the line idle, it
sends its frame immediately
(with probability 1).
This method has the highest
chance of collision because
two or more stations may
find the line idle and send
their frames immediately.
Note that Ethernet uses this
method.

Flow diagram for 1-persistent

287

Non-persistent

In the non-persistent method, a


station that has a frame to send
senses the line.
If the line is idle, it sends
immediately.
If the line is not idle, it waits a
random amount of time and
then senses the line again.
The non-persistent approach
reduces the chance of collision
because it is unlikely that two or
more stations will wait the same
amount of time and retry to
send simultaneously.
However, this method reduces
the efficiency of the network
because (he medium remains
idle when there may be stations
with frames to send.
288

Link Layer and Multiple Access

Page 86

Lecture notes

Wireless Techniques by Jorma Kekalainen

p-Persistent
The p-persistent method is used if the channel has
time slots with a slot duration equal to or greater
than the maximum propagation time.
The p-persistent approach combines the advantages
of the other two strategies.
It reduces the chance of collision and improves
efficiency.
In this method, after the station finds the line idle it
follows these steps:
1. With probability p, the station sends its frame.
2. With probability q = 1 p, the station waits for the
beginning of the next time slot and checks the line again.
a) If the line is idle, it goes to step 1.
b) If the line is busy, it acts as though a collision has occurred and
uses the back-off procedure.
289

Recap: Back-off time procedure


The time-out period is equal to the maximum possible roundtrip propagation delay, which is twice the amount of time
required to send a frame between the two most widely
separated stations (2 x Tp).
The back-off time TB is a random value that normally depends
on K (the number of attempted unsuccessful transmissions).
The formula for TB depends on the implementation.
One common formula is the binary exponential back-off.
In this method, for each retransmission, a multiplier in the
range 0 to 2K-1 is randomly chosen and multiplied by TP
(maximum propagation time) or Tfr (the average time required to
send out a frame) to find TB.
Note that in this procedure, the range of the random numbers
increases after each collision.
The value of Kmax is usually chosen as 15.
290

Link Layer and Multiple Access

Page 87

Lecture notes

Wireless Techniques by Jorma Kekalainen

Recap: Back-off time procedure for pure


ALOHA protocol

291

p-Persistent

292

Link Layer and Multiple Access

Page 88

Lecture notes

Wireless Techniques by Jorma Kekalainen

Flow diagram for three persistence


methods

293

Carrier Sense Multiple Access with


Collision Detection (CSMA/CD)
The CSMA method does not specify the procedure
following a collision.
Carrier sense multiple access with collision detection
(CSMA/CD) adds the algorithm to handle the
collision.
In this method, a station monitors the medium during
it sends a frame to see if the transmission was
successful.
If so, the station is finished, if, however, there is a
collision, the frame is sent again.
To better understand CSMA/CD, let us look at the
first bits transmitted by the two stations involved in
the collision.
294

Link Layer and Multiple Access

Page 89

Lecture notes

Wireless Techniques by Jorma Kekalainen

Collision of the first bit in CSMA/CD

At time t1, station A has executed its persistence procedure and starts sending the
bits of its frame.
At time t2, station C has not yet sensed the first bit sent by A.
Station C executes its persistence procedure and starts sending the bits in its
frame, which propagate both to the left and to the right.
The collision occurs sometime after time t2.
Station C detects a collision at time t3 when it receives the first bit of As frame.
295
Station C immediately (or after a short time, but we assume immediately) aborts
transmission.

Collision of the first bit in CSMA/CD

Station A detects collision at time t4 when it receives the first bit of Cs frame; it
also immediately aborts transmission.
Looking at the figure, we see that A transmits for the duration t4 t1 C transmits
for the duration t3 t2.
Later we show that, for the protocol to work, the length of any frame divided by
the bit rate in this protocol must be more than either of these durations.
At time t4, the transmission of As frame, though incomplete, is aborted; at time
296 t3,
the transmission of Cs frame, though incomplete, is aborted.

Link Layer and Multiple Access

Page 90

Lecture notes

Wireless Techniques by Jorma Kekalainen

Collision and abortion in


CSMA/CD

297

CSMA/CD vs. CSMA

collision:
entire packet transmission
time wasted
298

Link Layer and Multiple Access

Page 91

Lecture notes

Wireless Techniques by Jorma Kekalainen

Minimum frame size


For CSMA/CD to work, we need a restriction on the frame size.
Before sending the last bit of the frame, the sending station
must detect a collision, if any, and abort the transmission.
This is so because the station, once the entire frame is sent,
does not keep a copy of the frame and does not monitor the
line for collision detection.
Therefore, the frame transmission time Tfr must be at least
two times the maximum propagation time Tp.
To understand the reason, let us think about the worst-case
scenario.
If the two stations involved in a collision are the maximum
distance apart, the signal from the first takes time to reach the
second, and the effect of the collision takes another time Tp to
reach the first.
So the requirement is that the first station must still be
transmitting after 2Tp.
299

Example
A network using CSMA/CD has a bandwidth of 10 Mbps. If
the maximum propagation time (including the delays in the
devices and ignoring the time needed to send a jamming
signal) is 25.6 s, what is the minimum size of the frame?
Solution
The frame transmission time is Tfr = 2 Tp = 51.2 s. This
means, in the worst case, a station needs to transmit for a
period of 51.2 s to detect the collision. The minimum size
of the frame is 10 Mbps 51.2 s = 512 bits or 64 bytes.
This is actually the minimum size of the frame for
Standard Ethernet.
300

Link Layer and Multiple Access

Page 92

Lecture notes

Wireless Techniques by Jorma Kekalainen

Procedure
The flow diagram for CSMA/CD is similar to the one
for the ALOHA protocol, but there are differences.
The first difference is the addition of the
persistence process.
We need to sense the channel before we start
sending the frame by using one of the persistence
processes (non-persistent, 1-persistent, or ppersistent).
The corresponding box can be replaced by one of the
persistence processes.

301

Flow diagram for the CSMA/CD

302

Link Layer and Multiple Access

Page 93

Lecture notes

Wireless Techniques by Jorma Kekalainen

Procedure

The second difference is the frame transmission.


In ALOHA, we first transmit the entire frame and then wait for an
acknowledgment.
In CSMA/CD, transmission and collision detection is a continuous
process.
We do not send the entire frame and then look for a collision.
The station transmits and receives continuously and simultaneously
(using two different ports).
We use a loop to show that transmission is a continuous process.
We constantly monitor in order to detect one of two conditions: either
transmission is finished or a collision is detected.
Either event stops transmission.
When we come out of the loop, if a collision has not been detected, it
means that transmission is complete; the entire frame is transmitted.
Otherwise, a collision has occurred.
The third difference is the sending of a short jamming signal that
enforces the collision in case other stations have not yet sensed the
collision.
303

Energy Level
We can say that the level of energy in a channel can
have three values:
zero,
normal, and
abnormal.

At the zero level, the channel is idle.


At the normal level, a station has successfully
captured the channel and is sending its frame.
At the abnormal level, there is a collision and the
level of the energy is twice the normal level.
A station that has a frame to send or is sending a
frame needs to monitor the energy level to
determine if the channel is idle, busy, or in collision
mode.
304

Link Layer and Multiple Access

Page 94

Lecture notes

Wireless Techniques by Jorma Kekalainen

Energy level during transmission,


idleness, or collision

305

Throughput
The throughput of CSMA/CD is greater than that
of pure or slotted ALOHA.
The maximum throughput occurs at a different value
of G and is based on the persistence method and the
value of p in the p-persistent approach.
For 1-persistent method the maximum throughput
is around 50 percent when G = 1.
For non-persistent method, the maximum
throughput can go up to 90 percent when G is
between 3 and 8.
G is the average number of frames generated by the system during one frame306
transmission time

Link Layer and Multiple Access

Page 95

Lecture notes

Wireless Techniques by Jorma Kekalainen

CSMA/CD (Collision Detection)


CSMA/CD:
collisions detected
colliding transmissions aborted, reducing channel
wastage
human analogy: the polite conversationalist

collision detection:
easy in wired LANs: measure signal strengths,
compare transmitted, received signals
difficult in wireless LANs: received signal
strength overwhelmed by local transmission
strength and time varying channel
307

Wireless link problems


A higher and time-varying bit error rate is not the only
difference between a wired and wireless link.
Recall that in the case of wired broadcast links, all nodes
receive the transmissions from all other nodes.
In the case of wireless links, the situation is not so simple.
With the so called hidden station problem, physical
obstructions in the environment (for example, a mountain or a
building) may prevent stations (A,C) from hearing each others
transmissions, even though these transmissions are interfering
at the destination (B).

B
308

Link Layer and Multiple Access

Page 96

Lecture notes

Wireless Techniques by Jorma Kekalainen

Example: Undetectable collisions


Undetectable collisions at the receiver results from the fading
of a signals strength as it propagates through the wireless
medium.
Figure illustrates the case where A and C are placed such that
their signals are not strong enough to detect each others
transmissions, yet their signals are strong enough to interfere
with each other at station B.
B

C
Cs signal
strength

As signal
strength

space

The hidden station problem and fading make multiple access in a


wireless network considerably more complex than in a wired
network.

309

Fading
In wireless communications, fading is deviation of the
attenuation that a carrier-modulated telecommunication
signal experiences over certain propagation media.
The fading may vary with
time,
geographical position and
radio frequency.

Fading is modelled as a random process.


A fading channel is a communication channel that experiences
fading.
In wireless systems, fading may either be due to multipath
propagation, referred to as multipath fading, or due to
shadowing from obstacles affecting the wave propagation,
sometimes referred to as shadow fading.
310

Link Layer and Multiple Access

Page 97

Lecture notes

Wireless Techniques by Jorma Kekalainen

Wireless network characteristics


Multiple wireless senders and receivers create
additional problems (beyond multiple access):
B

Hidden station problem


B, A hear each other
B, C hear each other
A, C can not hear each other
means A, C unaware of their
interference at B

Cs signal
strength

As signal
strength

space

Signal attenuation:
B, A hear each other
B, C hear each other
A, C can not hear each other
interfering at B
311

Carrier Sense Multiple Access with


Collision Detection (CSMA/CD)
The basic idea behind CSMA/CD is that a station needs to be
able to receive (to detect a collision) while transmitting.
When there is no collision, the station receives one signal: its
own signal.
When there is a collision, the station receives two signals: its
own signal and the signal transmitted by a second station.
To distinguish between these two cases, the received signals in
these two cases must be significantly different.
In other words, the signal from the second station needs to add
a significant amount of energy to the one created by the first
station.
In a wired network, the received signal has almost the same
energy as the sent signal because either the length of the cable
is short or there are repeaters that amplify the signal between
the source and the destination.
This means that in a collision, the detected energy almost
doubles.
312

Link Layer and Multiple Access

Page 98

Lecture notes

Wireless Techniques by Jorma Kekalainen

Carrier Sense Multiple Access with


Collision Avoidance (CSMA/CA)
In a wireless network much of the sent energy is lost
in transmission.
The received signal has very little energy.
Therefore, a collision may add only a few percent
additional energy. This is not useful for effective
collision detection.
We need to avoid collisions on wireless networks
because collisions cannot be detected.
Carrier sense multiple access with collision avoidance
(CSMA/CA) was invented for wireless networks.
313

Timing in CSMA/CA

Collisions are avoided through the use


of CSMA/CAs three strategies: the
interframe space (IFS), the contention
window, and acknowledgments.
314

Link Layer and Multiple Access

Page 99

Lecture notes

Wireless Techniques by Jorma Kekalainen

InterFrame Space (IFS)


Collisions are avoided by postponing transmission even if the
channel is found idle.
When an idle channel is found, the station does not send
immediately.
It waits for a period of time called the interframe space or IFS.
Even though the channel may appear idle when it is sensed, a
distant station may have already started transmitting.
The distant stations signal has not yet reached this station.
The IFS time allows the front of the transmitted signal by the
distant station to reach this station.
If after the IFS time the channel is still idle, the station can
send, but it still needs to wait a time equal to the contention
time.

315

Note

In CSMA/CA, the IFS can also be used


to define the priority of a station or a
frame type.
For example, a station that is assigned a
shorter IFS has a higher priority.

316

Link Layer and Multiple Access

Page 100

Lecture notes

Wireless Techniques by Jorma Kekalainen

Contention window
The contention window is an amount of time divided into slots.
A station that is ready to send chooses a random number of
slots as its wait time.
The number of slots in the window changes according to the
binary exponential back-off strategy.
This means that it is set to one slot the first time and then
doubles each time the station cannot detect an idle channel
after the IFS time.
This is very similar to the p-persistent method except that a
random outcome defines the number of slots taken by the
waiting station.
One interesting point about the contention window is that the
station needs to sense the channel after each time slot.
However, if the station finds the channel busy, it does not
restart the process; it just stops the timer and restarts it when
the channel is sensed as idle.
This gives priority to the station with the longest waiting time.
317

Note

In CSMA/CA, if the station finds the


channel busy, it does not restart the
timer of the contention window;
it stops the timer and restarts it when
the channel becomes idle.

318

Link Layer and Multiple Access

Page 101

Lecture notes

Wireless Techniques by Jorma Kekalainen

Acknowledgment
With all these precautions, there still may be
a collision resulting in destroyed data.
In addition, the data may be corrupted
during the transmission.
The positive acknowledgment and the timeout timer can help guarantee that the
receiver has received the frame.

319

Procedure
Flow diagram for CSMA/CA
shows the procedure.
Note that the channel needs
to be sensed before and
after the IFS (InterFrame
Space) .
The channel also needs to be
sensed during the contention
time.
For each time slot of the
contention window, the
channel is sensed.
If it is found idle, the timer
continues; if the channel is
found busy, the timer is
stopped and continues after
the channel becomes idle
again.
320

Link Layer and Multiple Access

Page 102

Lecture notes

Wireless Techniques by Jorma Kekalainen

CSMA/CA and wireless networks


CSMA/CA was mostly intended for use in wireless
networks.
The procedure described above, however, is not
sophisticated enough to handle some particular issues
related to wireless networks, such as hidden
terminals or exposed terminals.
We will see how these issues are solved by adding
hand-shaking features to the above protocol.
CSMA/CA protocol with hand-shaking used in wireless
networks will be seen in the following flowchart.

321

CSMA/CA flowchart used in wireless


LANs

Distributed InterFrame
Space (DIFS)
Request To Send (RTS)
Clear To Send (CTS)
Short InterFrame
Space (SIFS)

322

Link Layer and Multiple Access

Page 103

Lecture notes

Wireless Techniques by Jorma Kekalainen

Reliable data delivery


More efficient to deal with errors at the
MAC level than higher layer (such as TCP)
Frame exchange protocol
Source station transmits data
Destination responds with acknowledgment (ACK)
If source does not receive ACK, it retransmits frame

Four frame exchange

Source issues Request To Send (RTS)


Destination responds with Clear To Send (CTS)
Source transmits data
Destination responds with ACK
323

Hand-shaking

1. Before sending a frame, the


source station senses the
medium by checking the energy
level at the carrier frequency.
After the station is found to be
idle, the station waits for a
period of time called the
Distributed InterFrame Space
(DIFS); then the station sends a
control frame called the request
to send (RTS).

2. After receiving the RTS and


waiting a period of time called
the Short InterFrame Space
(SIFS), the destination station
sends a control frame, called the
clear to send (CTS), to the
source station.
This control frame indicates
that the destination station is
ready to receive data.

Link Layer and Multiple Access

324

Page 104

Lecture notes

Wireless Techniques by Jorma Kekalainen

Hand-shaking
3. The source station sends
data after waiting an
amount of time equal to
SIFS (Short InterFrame
Space).
4. The destination station,
after waiting an amount of
time equal to SIFS, sends
an acknowledgment to show
that the frame has been
received.
Acknowledgment is needed in
this protocol because the
station does not have any
means to check for the
successful arrival of its
data at the destination.
325

Note. The lack of collision in CSMA/CD is a kind


of indication to the source that data have arrived.

Reliable data delivery phases

1. Before sending a frame, the


source station senses the medium
by checking the energy level at
the carrier frequency.
a. The channel uses a persistence
strategy with back-off until the
channel is idle.
b. After the station is found to be
idle, the station waits for a period
of time called the Distributed
InterFrame Space (DIFS); then
the station sends a control frame
called the request to send (RTS).

2. After receiving the RTS and


waiting a period of time called the
Short InterFrame Space (SIFS),
the destination station sends a
control frame, called the clear to
send (CTS), to the source station.
This control frame indicates that
the destination station is ready
to receive data.
326

Link Layer and Multiple Access

Page 105

Lecture notes

Wireless Techniques by Jorma Kekalainen

Reliable data delivery phases


3. The source station sends
data after waiting an amount
of time equal to SIFS.
4. The destination station,
after waiting an amount of
time equal to SIFS, sends an
acknowledgment to show that
the frame has been received.
Acknowledgment is needed in
this protocol because the
station does not have any
means to check for the
successful arrival of its data
at the destination.
327

No backoff => collision is certain


Suppose that several stations (B and C below) are
waiting to access the wireless medium.
When the channel becomes idle, these stations
start sending their packets at the same time =>
collision!
Station A

ACK

Station B

Collision!

Station C
DIFS

328

Link Layer and Multiple Access

Page 106

Lecture notes

Wireless Techniques by Jorma Kekalainen

Backoff => collision probability is


reduced
Contending stations generate random backoff values bn.
Backoff counters count downwards, starting from bn.
When a counter reaches zero, the station is allowed to send
its frame.
All other counters stop counting until the channel becomes
idle again.
Station A

ACK

Backoff

Station B

Remaining
backoff time
bn is large

Station C
DIFS

bn is small
329

Network Allocation Vector (NAV)

How do other stations defer sending


their data if one station acquires
access?
In other words, how is the collision
avoidance aspect of this protocol
accomplished?
The key is a feature called NAV.
When a station sends an RTS frame,
it includes the duration of time
that it needs to occupy the
channel.
The stations that are affected by
this transmission create a timer
called a network allocation vector
(NAV) that shows how much time
must pass before these stations are
allowed to check the channel for
idleness.
Each time a station accesses the
system and sends an RTS frame,
other stations start their NAVs.
In other words, each station, before
sensing the physical medium to see if
it is idle, first checks its NAV to see
if it has expired.

Link Layer and Multiple Access

330

Page 107

Lecture notes

Wireless Techniques by Jorma Kekalainen

Collision during handshaking


What happens if there is collision during the time
when RTS or CTS control frames are in transition,
often called the handshaking period?
Two or more stations may try to send RTS frames at
the same time.
These control frames may collide.
However, because there is no mechanism for collision
detection, the sender assumes there has been a
collision if it has not received a CTS frame from the
receiver.
The back-off strategy is employed, and the sender
tries again.
331

Hidden station problem


Figure shows an example of the hidden station problem.
Station B has a transmission range shown by the left oval
(sphere in space); every station in this range can hear any
signal transmitted by station B.
Station C has a transmission range shown by the right oval
(sphere in space); every station located in this range can hear
any signal transmitted by C.
Station C is outside the transmission range of B; likewise,
station B is outside the transmission range of C.
Station A, however, is in the area covered by both B and C; it
can hear any signal transmitted by B or C.

332

Link Layer and Multiple Access

Page 108

Lecture notes

Wireless Techniques by Jorma Kekalainen

Hidden station problem


Assume that station B is sending data to station A.
In the middle of this transmission, station C also has data to
send to station A.
However, station C is out of Bs range and transmissions from B
cannot reach C.
Therefore C thinks the medium is free.
Station C sends its data to A, which results in a collision at A
because this station is receiving data from both B and C.
In this case, we say that stations B and C are hidden from
each other with respect to A.
Hidden stations can reduce the capacity of the network
because of the possibility of collision.

333

Solution: Hand-shaking
The solution to the hidden station problem is the use of the
handshake frames (RTS and CTS) discussed earlier.
Figure shows that the RTS message from B reaches A, but
not C.
However, because both B and C are within the range of A, the
CTS message, which contains the duration of data
transmission from B to A reaches C.
Station C knows that some hidden station is using the channel
and refrains from transmitting until that duration is over.

334

Link Layer and Multiple Access

Page 109

Lecture notes

Wireless Techniques by Jorma Kekalainen

Note

The CTS frame in CSMA/CA handshake


can prevent collision from
a hidden station.

335

Exposed station problem

The exposed station problem is the inverse of the hidden station


problem.
In this problem a station refrains from using an available channel.
In Figure, station A is transmitting to station B.
Station C has some data to send to station D, which could be sent
without interfering with the transmission from A to B.
However, station C is exposed to transmission from A; it hears what
A is sending and thus refrains from sending.
In other words, C is too conservative and wastes the capacity of the
channel.

336

Link Layer and Multiple Access

Page 110

Lecture notes

Wireless Techniques by Jorma Kekalainen

Exposed station problem

Station C hears the RTS from A, but does not hear the CTS from B.
Station C, after hearing the RTS from A, can wait for a time so that
the CTS from B reaches A; it then sends an RTS to D to show that it
needs to communicate with D.
Both stations D and A may hear this RTS, but station A is in the
sending state, not the receiving state.
Station D, however, responds with a CTS. The problem is here.
If station A has started sending its data, station C cannot hear the
CTS from station D because of the collision; it cannot send its data to
D.
It remains exposed until A finishes sending its data as Figure shows.

The handshaking
messages RTS and CTS
cannot help in this case.
337

Recap: CSMA/CD vs. CSMA/CA


CSMA/CD is the MAC method used in a wired
LAN (Ethernet).
Wired LAN stations can (whereas wireless
stations cannot) detect collisions.
CSMA/CD rule:
Backoff after collision

Basic CSMA/CD operation:


1) Wait for free medium
2) Transmit frame
3) If collision, stop transmission immediately
4) Retransmit after random time (backoff)

338

Link Layer and Multiple Access

Page 111

Lecture notes

Wireless Techniques by Jorma Kekalainen

Recap: CSMA/CD vs. CSMA/CA


CSMA/CA (Collision Avoidance) is the MAC method
used in a wireless LAN.
Wireless stations cannot detect collisions (i.e. the
whole packets will be transmitted anyway).
Basic CSMA/CA operation:
1)
2)
3)
4)
5)

CSMA/CA rule:
Backoff before
collision

Wait for free medium


Wait a random time (backoff)
Transmit frame
If collision, the stations do not notice it
Collision => erroneous frame => no ACK
returned

339

Multiple-access protocols

340

Link Layer and Multiple Access

Page 112

Lecture notes

Wireless Techniques by Jorma Kekalainen

MAC protocols
Channelization (channel partitioning MAC) protocols:
share channel efficiently and fairly at high load
inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active node!
Random access MAC protocols:
efficient at low load: single node can fully utilize
channel
high load: collision overhead
Controlled access (taking turns) protocols:
look for best of both worlds!
341

Controlled access MAC protocols


In controlled access, the stations consult one
another to find which station has the right to
send.
A station cannot send unless it has been
authorized by other stations.
Reservation
In the reservation method, a station needs to
make a reservation before sending data.
Time is divided into intervals.
In each interval, a reservation frame precedes the
data frames sent in that interval.
342

Link Layer and Multiple Access

Page 113

Lecture notes

Wireless Techniques by Jorma Kekalainen

Reservation
If there are N stations in the system, there
are exactly N reservation minislots in the
reservation frame.
Each minislot belongs to a station.
When a station needs to send a data frame, it
makes a reservation in its own minislot.
The stations that have made reservations can
send their data frames after the reservation
frame.
343

Reservation access method


Figure shows a situation with five stations and a five-minislot
reservation frame.
In the first interval, only stations 1, 3, and 4 have made
reservations.
In the second interval, only station 1 has made a reservation.

344

Link Layer and Multiple Access

Page 114

Lecture notes

Wireless Techniques by Jorma Kekalainen

Polling
Polling works with topologies in which one device is
designated as a primary station and the other devices
are secondary stations.
All data exchanges must be made through the
primary device even when the ultimate destination is
a secondary device.
The primary device controls the link; the secondary
devices follow its instructions.
It is up to the primary device to determine which
device is allowed to use the channel at a given time.

345

Select and poll functions in polling


access method
The primary device is always the initiator of a session.
If the primary wants to receive data, it asks the secondaries if
they have anything to send; this is called poll function.
If the primary wants to send data, it tells the secondary to get
ready to receive; this is called select function.

346

Link Layer and Multiple Access

Page 115

Lecture notes

Wireless Techniques by Jorma Kekalainen

Polling
master node invites
slave nodes to
transmit in turn
typically used with
dumb slave devices
concerns:
polling overhead
latency
single point of
failure (master)

data

poll

master
data

slaves

347

Token Passing
In the token-passing method, the stations in a
network are organized in a logical ring.
In other words, for each station, there is a
predecessor and a successor.
The predecessor is the station which is logically
before the station in the ring; the successor is the
station which is after the station in the ring.
The current station is the one that is accessing
the channel now.
The right to this access has been passed from
the predecessor to the current station.
The right will be passed to the successor when the
current station has no more data to send.
348

Link Layer and Multiple Access

Page 116

Lecture notes

Wireless Techniques by Jorma Kekalainen

Token Passing
But how is the right to access the channel passed
from one station to another?
In this method, a special packet called a token circulates
through the ring.
The possession of the token gives the station the right to
access the channel and send its data.
When a station has some data to send, it waits until it
receives the token from its predecessor.
It then holds the token and sends its data.
When the station has no more data to send, it releases the
token, passing it to the next logical station in the ring.
The station cannot send data until it receives the token again
in the next round.
When a station receives the token and has no data to send, it
just passes the token to the next station.
349

Logical ring and physical topology in


token-passing access method

350

Link Layer and Multiple Access

Page 117

Lecture notes

Wireless Techniques by Jorma Kekalainen

Token management
Token management is needed for this access method.
Stations must be limited in the time they can have
possession of the token.
The token must be monitored to ensure it has not
been lost or destroyed.
For example, if a station that is holding the token fails, the
token will disappear from the network.

Another function of token management is to assign


priorities to the stations and to the types of data
being transmitted.
Token management is needed to make low-priority
stations release the token to high-priority stations
351

Controlled access protocols


Token passing:
control token passed
from one node to next
sequentially.
token message
concerns:
token overhead
latency
single point of failure
(token)

(nothing
to send)
T

data
352

Link Layer and Multiple Access

Page 118

Lecture notes

Wireless Techniques by Jorma Kekalainen

Summary
We can consider the data link layer as two
sublayers.
The upper sublayer is responsible for data link
control, and the lower sublayer is responsible for
resolving access to the shared media.

Many formal protocols have been devised to


handle access to a shared link.
We categorize them into three groups:
random access protocols,
controlled access protocols, and
channelization protocols.
353

Link Layer and Multiple Access

Page 119

You might also like