# The zero-one principle for switching networks

```Online Packet Switching
Techniques and algorithms
Yossi Azar
Tel Aviv University
Motivation
• Current networks are mostly packet-based
(Internet)
• QoS guarantees essential to most network
applications
• Steady traffic increase + constant
fluctuation lead to packet loss
• Objective: transmit “valuable” packets
Single queue switch
B
9
7
4
• FIFO queue with bounded capacity (B)
• Packets marked with values
• One packet transmitted each time step
• Objective: maximize total transmitted value
Greedy single queue admission
control (preemptive)
Algorithm G
Accept packets greedily. Packet accepted if:
• Queue not full
-or-
• Packet with smallest value discarded from
queue
Online Greedy is not optimal
Same
goespackets
on… arrive
t=B+2
tNo
=3
1more
2
B
B
B
B
1ε
1ε
1ε
1ε
1ε
ε
1ε
ε
1ε
ε
…
… ε
G
1ε
… 1
1
B
1ε
1ε
1
1ε
1ε
ε
1
1
1
1
…
… 1
Opt
1ε
1
2B
… 1
Single queue – results
• Upper bound:
– [KLMPSS '01] – Greedy is 2-competitive
– [KMvS '03] – 1.98-competitive
– [BFKMSS '04] – 1.75-competitive
• Lower bound:
– [AMZ ’03] – 1.41
Multi-Queue QoS switch
…
3 9
…
7
…
m
1
…
4
…
B
• m bounded capacity FIFO queues
• Single output port, one packet transmitted
each time step
• Objective: maximize total transmitted value
Multi-queue switch - results
• Arbitrary values:
– [AR '03] – 4-competitive algorithm
– [AR '04] – 3-competitive algorithm
• Unit value:
– [AR '03] – deterministic 2-competitive
randomized 1.58-competitive
– [AS '04] – deterministic 1.89
– [AL '04] - deterministic 1.58 ( B  m )
Special case – unit packets
• Model remains the same
• All packets have equal (unit) value
• Goal: maximize number of transmitted
packets
• Motivation: IP networks
• Better algorithms for this case
1
1
1
m
1
1
B
Lower bound for unit-value
• B=1
• Packet arrives to each queue
• As long as ON has at least two full
queues:
– ON empties some queue
– Adversary empties queue not used by ON
– New packet arrives to this queue
t=3
t=2
t=4
t=7
t=1
Lower bound - construction
ON
X4
2
3
No more
packets
arrive
OPT
X
X7
2
3
4
Getting below 2-competitive
•
•
•
•
–
–
“Any” algorithm is 2-competitive
Randomized 1.58-compeititve (AR ‘03)
(Albers+Schmidt ’04):
Any Greedy is at least 2-competitive
First deterministic 1.89
Deterministic 1.58 (large buffers) (AL ’04)
AS
0. Partition into busy periods
1. If load(max_queue) > B/2 – use max_queue
2. Otherwise, if there are queues that were
never full – use max_queue among them
3. Otherwise, use max_queue
Multi-Queue QoS switch
…
3 9
…
7
…
m
1
…
4
…
B
• m bounded capacity FIFO queues
• Single output port, one packet transmitted
each time step
• Objective: maximize total transmitted value
4-competitive upper bound
• Based on reduction to single-queue
• Generic Scheme: (A+Richter ’03)
Single queue
C-competitive
Multi-queue
scheduling
+
2C-competitive
Model Relaxation
• Relaxation:
– packets can be transmitted in any order,
not only FIFO
– preemption allowed
• Optimal solution remains unchanged
• Relaxation adds considerable strength to
online algorithms
Relaxed model – algorithm Relax
Algorithm Relax
• Admission control: Greedy algorithm (G) in
each queue (optimal non-fifo)
• Scheduling: Transmit packet with largest
value in all queues
Relax demonstration
t = 521348
9
74
912
1
9
17
4
92
9
1
9
37
3
7
9
7
7
4
79
7
3
1
Generic Scheme
Algorithm M(A)
(A – admission control for single queue)
• Maintain online simulation of Relax
• Admission control: according to A
• Scheduling: according to Relax
M(G) - demonstration
Relax simulation
9
t = 54312
9
73
79
93
84
8
4
73
79
93
84
8
84
9
9
8
7
4
3
9
4
9
8
Algorithm Relax - analysis
Theorem 1: Relax is 2-competitive in relaxed
model.
Proof:
• Relies on potential function
• Based on minimum weighted perfect matching in
a graph that measures the distance between the
values on Relax and OPT
Algorithm M(A) - analysis
Theorem 2: CM(A) ≤ CRelax∙CA = 2∙CA
Proof:
• Relax is 2-competitive
• In each queue we lose a factor of CA
compared to non-fifo, by transforming the
input sequence
Compact σi:
σi :
2
4
7
1
3
1
4
3
2
9
1
3
1
4
7
9
7
7
3
time
σ*i :
2
4
1
7
1
3
2
9
1
4
3
7
3
1
3
4
7
9
7
time
Corollaries
• Preemptive: 4-competitive (using KLMPSS ’01)
• Unit-value: 2-competitive
• 2-values, preemptive: 2.6-comp. (using LP ’02)
• Non-preemptive: 2e∙ln(max / min)-competitive
(using AMZ ’03)
Zero-One Principle (A+Richter ’04)
• Analysis of packets with arbitrary values is
complicated
• Goal: reduce to “simpler” sequences
• Zero-one principle:
Comparison-based algorithm (given a network)
Sufficient to analyze 0/1 sequences
(with arbitrary tie breaking)
Comparison-based algorithms
Informally, A is comparison-based if decisions
made based on relative order between values
Notation:
• A(σ) – possible output sequences, ties broken
in every possible way
• V(σ) – total value of sequence
Zero-one principle
Theorem:
Let A be comparison-based (deterministic
or randomized).
A achieves c-approximation if and only if
A achieves c-approximation with respect
to all 0/1 sequences, for all possible tie breaking
Zero-one principle - proof
1
Define: ft(x) =
x≥t
0 otherwise
σ:
3
1
5
9
4
3
f3(σ):
1
0
1
1
1
1
f6(σ):
0
0
0
1
0
0
Proof – continued
Claim1: Sequence can be broken into sum
of 0/1 sequences using ft:

V ( )   V ( ft ( ))dt
t 0
Claim 2: For comparison-based A, sequence
σ, and t ≥ 0 :
V ( ft ( A( )))  V ( A( ft ( )))
Putting it all together:
Claim 1
V ( A( ))
Claim 2

  V ( f ( A( ))) dt 
t
t 0


 V ( A( f ( )))dt  
t
t 0
t 0
1
V (Opt( ft ( ))) dt
c
Claim 1
ft ( ) - 0/1 sequence


1
V ( ft (Opt ( ))) dt

c t 0

1
V (Opt ( ))
c
Application 1
Algorithm TLH
• Admission control: greedy,
independently in each queue
m
B
• Scheduling: Transmit packet
with largest value among all
packets at head of queues
0/1 principle -> TLH is
3-competitive
CIOQ switch
1
.
.
.
1
.
.
.
.
.
.
•
•
•
•
.
.
.
N
N
N×N switch
Virtual output queues at input ports
Speedup S
Objective: maximize total transmitted value
Results
• General CIOQ switch:
– arbitrary packet values
– Any speedup
• (Kesselman+Rosen ’03):
– Linear in speedup
-or– Logarithmic in value range
• (A+Richter ’04):
– constant-competitive algorithm
Dynamic Routing
• All models can be generalized to networks, with
switches at the nodes
–
–
–
–
Line topology
Cycles
Trees
General networks
• With / without routing decisions
Example (line)
•
Dynamic Routing on a line of length k
0/1 principle -> simple alg. is (k+1)-comp.
•
Greedy is at least k0.5-competitive (AKOR ’03)
Example (tree)
•
Merging trees (KLMP ’03)
Summary
• Single queue
• Multiple queues
• Multiple queues – unit packets
• Zero-One principle
• CIOQ switch
• Networks (e.g. line, tree)
Open problems
• Explore connections between different models
• General theorems to facilitate analysis
• Improve upper bounds of specific problems:
–
–
–
–
Single-queue switches
Multi-queue switches
Dynamic routing on a line
General networks
```