(Alan Holt) Network Performance Analysis Using TH PDF
(Alan Holt) Network Performance Analysis Using TH PDF
(Alan Holt) Network Performance Analysis Using TH PDF
Alan Holt
Network Performance
Analysis
123
Alan Holt, PhD
[email protected]
A catalogue record for this book is available from the British Library
Apart from any fair dealing for the purposes of research or private study, or criticism or review, as per-
mitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced,
stored or transmitted, in any form or by any means, with the prior permission in writing of the publish-
ers, or in the case of reprographic reproduction in accordance with the terms of licences issued by the
Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to the
publishers.
The use of registered names, trademarks, etc. in this publication does not imply, even in the absence of a
specific statement, that such names are exempt from the relevant laws and regulations and therefore free
for general use.
The publisher makes no representation, express or implied, with regard to the accuracy of the information
contained in this book and cannot accept any legal responsibility or liability for any errors or omissions
that may be made.
987654321
springer.com
Chi and Emily
Preface
Acknowledgments
The author would like to thank the following people for the valuable contribution
they made to this book: Dr Lin-Yi Chou (University of Waikato), Dr Sue Casson
(Leeds University), Dr Adrian Davies, Michael Dewsnip (DL Consulting), Dr Chi-
Yu Huang (DL Consulting), Zhiwei Liu (University of Waikato), and Prof. John
Monk (Open University). Thanks also to Catherine Brett of Spinger for guiding me
through this process.
I especially want to thank my wife for all her love and encouragement throughout
this period. I could not have undertaken this project without her support.
Alan Holt
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VII
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XV
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Quality of Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Network Utilisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Traffic Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Queue Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 Programming in J . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.1 Verb Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1.1 Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1.2 Forks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.1.3 Longer Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.1.4 Conjunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.2.1 More z-transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.2.2 Shannon’s Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2.3 Euler’s Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2.4 Information Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3 Good Programming Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.1 Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.2 Explicit Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.4 Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4 Network Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.1 Characterising Traffic Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2 Min-Plus Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.3 Mathematical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3.1 Wide-Sense Increasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.3.2 Types of Wide-Sense Increasing Functions . . . . . . . . . . . . . . . 59
4.3.3 Subadditive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.3.4 Subadditive Closure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4.3.5 Concavity and Convexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.3.6 Star Shaped Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4 Arrival Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.5 Service Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.5.1 Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.5.2 Performance Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.6 Streaming Video Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.7 Effective Bandwidth and Equivalent Capacity . . . . . . . . . . . . . . . . . . . 78
4.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Contents XI
Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
A.1 Scripts from Chapter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
A.2 Scripts from Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
A.3 Scripts from Chapter 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
A.4 Scripts from Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
A.5 Scripts from Chapter 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
A.6 Scripts from Chapter 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
A.7 Scripts from Chapter 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
List of Figures
Introduction
For reasons of tractibility, classical queuing theory assumes that the properties of net-
work traffic (arrival rates, service times) include the Markovian property. While the
Markovian assumption is valid for telephony networks, it has been widely reported
that, for data networks, traffic is fractal in nature [6, 13, 16, 37]. One way to represent
a traffic flow is as a stochastic process. Modelling traffic as Markovian stochastic
processes is attractive because flows can be characterised by only a small number
of parameters. Models of non-Markovian processes, however, are more complex and
analytical results are difficult to derive. Markovian traffic can be clearly distinguished
from Internet traffic patterns which exhibit properties of long-range dependence and
self-similarity. That is, traffic is bursty over a wide range of time scales. Backlog
and delay predictions are frequently underestimated if the Markovian property is
assumed when traffic is actually long-range dependent (and self-similar) [16, 28].
A number of methods for generating fractal-like traffic processes have been put for-
ward. Examples include Fractional ARIMA processes, Fractional Brownian motion,
chaotic maps and the superposition of heavy-tailed on/off sources. Network perfor-
mance can then be investigated using simulation techniques. Some of these fractal
traffic generating techniques are described in this book. We use J to simulate network
systems and analyse their performance under certain traffic conditions.
An alternative approach to simulation is network calculus. Network calculus is a
recent development where the exact properties of flows are unknown. The mathe-
matical foundations are based upon min-plus algebra, whereby the addition and mul-
tiplication operators of conventional algebra are exchanged for minimum and plus
operators. Instead of representing a traffic flow as stochastic process, a flow is char-
acterised by an envelope function. Service curves can also be expressed in this way.
Performance bounds can be derived through the application of min-plus algebraic
methods on flow arrival curves and network system service curves.
Another approach is to consider closed-loop methods of modelling networks. Inter-
net transport protocol such TCP (Transmission Control Protocol), and more recently
DCCP (Datagram Congestion Control Protocol [34]), adjust their transmission rates
2 1 Introduction
according to the congestion state of the network [29]. TCP sends data a “window”
at a time. TCP initially probes the network for bandwidth by increasing its window
size each time it receives an acknowledgment. TCP’s transmission rate is regulated
by the acknowledgment round-trip time. In the event of congestion, TCP reduces
its window size (and thus its transmission rate) and begins probing the network for
bandwidth once again. Congestion control algorithms can be modelled as dynamical
feedback systems, and flow patterns are governed by transport protocols reacting to
network events.
The aim of this book is to present network performance analysis techniques that do
not rely on the Markovian assumption. Topics in network performance analysis are
presented with the aid of the J programming language. J is rich in mathematical func-
tionality, which makes it an ideal tool for analytical methods. Throughout the book
a practical approach is favoured. Functions in J are developed in order to demon-
strate mathematical concepts, this enables the reader to explore the principles behind
network performance analysis.
The topics covered in this book are motivated by the author’s own research and in-
dustrial experience. The book outline is as follows. Chapters 2 and 3 provide an
introduction to the J programming language. Chapter 2 introduces the basic con-
cepts such as the data types and built-in J functions. Chapter 3 covers more advanced
topics, where the focus is programming in J.
Network calculus is introduced in Chapter 4. We demonstrate how arrival and ser-
vice curves can be expressed as J functions. We show how to derive upper bounds for
backlog, delay and output flow. Effective bandwidth and equivalent capacity tech-
niques are introduced as a means of deriving the network resource requirements for
deterministic QoS bounds.
Chapter 5 focuses on statistical analysis and stochastic processes. The concepts of
short-range and long-range dependence are introduced and we implement models
for generating time series with these properties. We introduce Autoregressive (AR)
and Moving Average (MA) models for generating short-range dependent time se-
ries. Fractional Autoregressive Integrated Moving Average (FARIMA) models are
presented for generating time series with long-range dependence and self-similarity.
In Chapters 6 and 7, we show how to simulate traffic with both short-range and
long-range dependence properties. In Chapter 6, we simulate traffic with discrete
on/off models using various random number generators to generate traffic with the
desired correlation properties. In Chapter 7, we show how chaotic maps can be used
to generate simulated traffic.
ATM QoS is covered in Chapter 8. Leaky bucket and virtual scheduling algorithms
are developed in J. We show how cell conformance can be analysed using these
algorithms by running them on simulated traffic from continuous on/off models.
Chapter 9 examines Internet congestion control. We use J to build binomial conges-
tion control algorithms and explore the parameters that govern congestion window
increase and decrease.
1.1 Quality of Service 3
The Internet was principally designed to offer a best-effort service [12]. While the
network makes a sincere attempt to transmit packets, there are no guarantees with
regard to reliable or timely delivery. Packets may be delayed, delivered out of order
or dropped. The end-to-end protocols (such as TCP) are given the responsibility of
recovering from these events. Packets incur delays during transmission due to link
speeds, and propagation delays. Delays are also incurred by packets waiting in buffer
queues. Memory buffers are used to resolve contention issues when two (or more)
packets arrive simultaneously at a communications link. A packet’s waiting time is
determined by the number of packets that are scheduled ahead of it; thus waiting
times increase with traffic volume. Furthermore, if traffic volumes are excessive,
contention for buffer memory arises, which is resolved by dropping packets.
Traffic management methods (and associated policies) can help to alleviate the trade-
off between QoS and network optimality. Traffic management is a complex technical
issue, but it is also an economical, political and ethical one. Like any limited re-
source, the allocation of network capacity can be somewhat controversial. Traffic
management policies are selected either to implement a neutral network, or a dif-
ferentiated one. In a neutral network, there is parity between users and services in
terms of how the network treats their packets. A neutral network however, does not
necessarily support fairness. Due to the flat-rate pricing policy of the Internet, heavy
users do not incur any additional financial cost over light users. Yet the burden of
congestion is borne by all.
In a differentiated network, there is discrimination between users and/or services.
The network provider controls the allocation of resources, electing to give some
users a better than best-effort service (and others a less than best-effort). Better than
best-effort services are covered extensively in the literature ([22, 73], for example).
Certain classes of user require either priority allocation or an assurance of a mini-
mum allocation of resources during periods of congestion. Resources are allocated
according to the particular QoS requirements of the user’s application. The aim is
either to guarantee or at least optimise QoS metrics, such as delay, jitter, throughput
or loss.
Less than best-effort (LBE), services are not so clearly defined. Typically, best-effort
is considered the lowest level of service [23]; that is, high-priority users are allo-
cated resources according to their needs, and any remaining resources are allocated
to lower-priority users. One may argue, however, that if a particular set of users is re-
ceiving a preferential service relative to another, then any “best-effort” commitment
to the low-priority users is not being met. The service they are receiving, therefore,
is almost certainly less than best-effort.
Nevertheless, the literature maintains that a best-effort service can be supported de-
spite the differentiation in flows and preferential resource allocation. Furthermore,
low-cost LBE services may be offered alongside best-effort and high-priority ser-
vices to users of applications that are tolerant to high loss rates, delay and jitter
4 1 Introduction
[19, 25]. During periods of congestion, LBE packets are delayed or dropped in pref-
erence to best-effort or high-priority traffic. Applications with LBE delivery can
make use of off-peak periods when network resources are underutilised. This en-
ables network providers to use otherwise spare capacity, without affecting best-effort
or higher priority traffic.
LBE services however, extend beyond low-cost service offerings by providers as a
means of selling available capacity on under-utilised links. There have been cases
where network providers have attempted to “discourage” the use of certain services
over their network. Voice over IP (VoIP) is a typical example. There have been
reports of provider discrimination against VoIP services. At the most basic level,
providers simply block IP ports such that VoIP traffic cannot pass between the sender
and receiver. A more subtle form of discouraging VoIP applications is delay packets
such that the QoS is degraded beyond a usable level [50]. VoIP users may be unaware
they are being discriminated against, believing that the low voice quality is merely
a by-product of a best-effort service, when in actual fact the provider is inflicting a
less-than best-effort service on them.
Less-than best-effort services can also arise from network provider business prac-
tices. The Internet is no longer a network formed through the “cooperative anarchy”
[65] of government agencies and academic institutions. The infrastructure is divided
amongst many competitive Internet Service Providers (ISPs). Tier 2 ISPs “buy” rout-
ing tables wholesale from transit providers; thus traffic is exchanged between ISPs
via transit networks. Rival ISPs, however, may elect to cooperate and exchange traffic
through a mutual peering arrangement [48]. The benefits of peering are (potentially)
two-fold. Firstly, ISPs in a peering arrangement reduce their transit costs. Secondly,
by eliminating the transit hop and taking a more direct route, traffic latency is re-
duced. A peering arrangement between two ISPs may be attractive to one ISP but
not the other. Without the consent of both parties, peering will not occur. This has
given rise to a number of dubious business practices, whereby one ISP tries to en-
courage other to peer with it. For example, if ISP B receives traffic from ISP A
through some prior peering arrangement with another ISP, then ISP A could, using
policy routing, forward its traffic to ISP B through a transit provider. Furthermore,
ISP A may compound ISP B’s transit costs by “replaying” traffic using a traffic gen-
erator [49]. Such practices do not constitute a sincere attempt to deliver packets, and
thus packet delivery is not best-effort.
Textbooks describe the Internet Protocol as a best-effort packet delivery mechanism
[12] and Internet commentators talk of “retaining” a neutral network [9]. According
to Sandvig, however, “the Internet isn’t neutral now” [60]. Nor has it been for a long
time. As the Internet grew in the 1990s, it suffered from the tragedy of the commons
[46] and was subject to “overgrazing.” Furthermore, the Internet carries content that
some find undesirable. Providers adopt differentiated traffic management policies in
order to address these issues. Consider the following scenarios:
1.2 Network Utilisation 5
the level of utilisation that can support a given QoS. Passmore conveys the perfor-
mance “limitations” of Ethernet [51]:
(*ˆ@-) 0 1 2 3
0 0.367879 0.270671 0.149361
From the example above, the indented line is the J command that is entered by the
user (the J prompt is a three-space indentation). The sequence of characters *ˆ@-
(enclosed in brackets) form a function; in this case they define the relationship be-
tween S and G in Equation (1.1). The list of values that follows is the argument
passed by the function (in this case the argument represents various values of G).
The function is applied to each value in the argument list and outputs a correspond-
ing value of S on the nonindented line below. The symbols ˆ, * and - are arithmetic
operators and represent the exponential function, multiplication and negation respec-
tively. The @ primitive is called a conjunction in J and acts as a sequencing operator.
Without going into detail at this point, think of @ as an apply operator. Thus, the ex-
ponential function is applied to the negated values of the arguments (G). The result
of this operation is then multiplied by the argument values. J composition rules may
not seem intuitive at first, but they will be covered in more detail later. It can be seen
that the throughput reaches a maximum of approximately S ≈ .0.37 for G = 1. For
pure Aloha (nonslotted), the maximum achievable throughput is even lower:
S = Ge−2G (1.2)
(*ˆ@-@+:) 0 0.5 1 2 3
0 0.18394 0.135335 0.0366313 0.00743626
1.2 Network Utilisation 7
(%>:) 0 1 2 3
0 0.5 0.666667 0.75
where % and >: are the division and increment operators. We can see from the re-
sults that CSMA yields a higher throughput than Aloha. A nonpersistent CSMA
station in back-off, defers a packet transmission for a random period after a busy
carrier becomes idle. This is to avoid two (or more) stations which have backed off,
from transmitting at the same time (causing a collision). Ethernet is a 1-persistent
CSMA protocol, which does not defer a random amount of time (transmits imme-
diately the carrier becomes idles). While 1-persistent CSMA yields a lower theo-
retical throughput than nonpersistent, Ethernet employs collision detection, which
make higher throughput levels possible. Indeed, Metcalfe and Boggs [47] showed
that (shared-media) Ethernet is capable of sustaining 95 percent utilisation.
The graph in Fig 1.1 shows the throughput curves for slotted Aloha, pure Aloha and
nonperistent CSMA. It is possible to plot graph in J. The plotting functions have to
be loaded:
The example below shows briefly how to plot a simple graph for the throughput of
CSMA. Note, however, that J’s graphing capabilties is outside the scope of this book.
Refer to the J User Manual for more details on the plot command. For convenience
assign G and S:
G =: 0 1 2 3
S =: (*ˆ@-) G
Ensure that you are running J interpreter as jw rather than jconsole. Then plot S
against G:
plot G;S
8 1 Introduction
0.8
nonpersistent CSMA
0.6
S (throughput)
0.4
sloted Aloha
0.2
pure Aloha
0.0
G (offered load)
When setting utilisation levels, some sense of the time scales to which they apply is
required. At the packet, cell or bit level time resolutions, a communications channel
is either occupied or not occupied it cannot be 30 percent occupied. Only at time res-
olutions greater than the packet (or cell) transmission time can communication links
be fractionally occupied. When we view traffic flows graphically, we do so for a par-
ticular monitoring period and aggregation interval. For the purpose of illustration we
present graphs (in Fig 1.2) showing network traffic for various levels of aggregation
and monitoring periods. This data was taken from the University of Waikato Internet
access link.1
For “calendar” time scales, such as days, weeks and years, traffic loads are non-
stationary. The top-left graph in Fig 1.2 shows the volume of traffic aggregated over
a weekly period for just over a year. Given that this link carries traffic from an aca-
demic institution, you can see two troughs at weeks 4 and 56, which are the Christ-
mas/New Year periods (one year apart). There is also a trough centred around week
32, which is the intersemester break. It can be seen from the top-left graph that there
is a rising trend in time, where the dashed line is a linear least-squares regression of
the weekly traffic volumes.
1
See http://www.wand.net.nz/ for details.
1.2 Network Utilisation 9
weekly daily
50
●● ●
●
● ●
● ●
●●
40
gigabytes
gigabytes
● ●
● ●● ●
● ●
●
30
● ●
20
● ●
● ●
●
●
●
10
●
sat sat sat sat sat sat
50
0 10 30 50 70 1 2 3 4 5 6 7
weeks weeks
5 minutes millisecond
8
400
6
300
megabytes
kilobytes
4
200
2
100
hours seconds
The top-right graph of Fig 1.2 shows the aggregate daily traffic volumes over a seven-
week period. It shows the periodicity of peaks and troughs for weekday and weekend
traffic respectively. There appears to be anomalously low traffic on Friday of the
second week and Monday of the third week; this corresponds to the Easter bank
holiday. The bottom-right graph (Fig 1.2) shows the five-minute traffic volumes over
one day. The busy and off-peak periods of the day are evident.
Traffic flows on these time scales do not provide much useful insight into queue
dynamics. Rather they are of more interest to the forecaster for the purpose of pre-
dicting future resource requirements or identifying peak and off-peak periods. While
useful for long/medium-term forecasting, the time intervals over which traffic is ag-
gregated are too long and the degree of “smoothing” does not convey any detailed
burst-level behaviour.
The bottom-right graph of Fig 1.2 shows burst-level traffic. The traffic aggregates for
each millisecond are shown for a one-second period. At these time scales, traffic is
(typically) stationary. In traditional telephony, traffic arrival processes smooth expo-
nentially quickly with the increase in aggregation interval. However, traffic patterns
in packet data networks have complex structures, even for periods of stationarity,
10 1 Introduction
when packet arrivals can be highly correlated in time, exhibiting local trends and
cycles [6, 13, 16, 28].
It is unlikely that there is some panacea utilisation figure that meets all capacity
planning requirements and delivers QoS. It is not that the “30 percent” rule is wrong;
in the absence of a better figure, it is as good as any. However, the QoS requirements
will vary according to the users and the applications they run.
• forwarding policy
• scheduling policy
• drop policy
If network providers do not apply any active traffic management, the respective for-
warding, scheduling and drop policies are (typically): shortest-path/lowest-cost to
destination, first-come-first-served (FCFS) and drop-from-tail. In a neutral network
environment, all packets, regardless of user and service, are treated the same. Users
compete with each other for resources. The (neutral) network provider does not pro-
tect users from one another, thus greedy users may get a larger proportion of re-
sources, while the pain of congestion is shared equally. Network providers may elect
to employ traffic management policies, such as Fair-Queuing [68] and Random Early
Detect (RED), [20] in order to distribute congestion costs amongst users in propor-
tion to their contribution to it.
Assuming dynamic routing protocols are being used (rather than static routing), the
traditional IP forwarding policy is the shortest-path (or least-cost) to destination.
Upon receiving the packet, each router examines the destination address in the IP
header and looks up the next hop of the corresponding router. The “shortest-path”
depends on the routing protocol. For example, RIP [12] uses number-of-hops as a
routing metric, whereas OSPF [69] uses a cost metric based upon the speed of the
link. Shortest-path routing algorithms can lead to traffic hotspots where links on the
shortest-path are congested, while those that are not, are underutilised.
Load balancing can be achieved by manually manipulating the routing metrics. This,
however, is not an ideal method, as a slight change in operating conditions can sig-
nificantly degrade the stability of the network.2
A better method is to use policy routing [44], whereby packets are routed based
on some attributes of the packet header other than the destination address (source
2
Speaking from bitter experience.
1.3 Traffic Management 11
address or port numbers for example). Packet routes are determined through network
management functions and traffic engineering policies. Policy routing does present a
number of problems. First of all, keeping track of routing policies currently in effect
is administratively difficult. Secondly, each packet incurs extra processing overheads
in determining the flow to which it belongs.
Protocols, such as Multiprotocol Label Switching (MPLS), [2] provide an infrastruc-
ture for the management of predefined paths through the network. MPLS routers at-
tach tags to packets at the edge of the network according to the flow to which they
belong. Flows can be identified by routers in the core with minimal overhead and
packets can be forwarded/scheduled/dropped accordingly.
There are two QoS frameworks for IP networks, namely, Differentiated services
(DiffServ) and Integrated services (IntServ), Differentiated services involve classi-
fying flows at the edge of the DiffServ “cloud” by setting the Differentiated Services
Code-Point (DSCP) in the IP header. Each code-point is associated with some class
of service. Thus, flows mapped to a particular class are forwarded, scheduled and
dropped according to a set of policies that implement the service class. DiffServ
specifies a coarse-grained QoS. Given that the DSCP is only one byte, there is a sig-
nificant restriction on the number of flows that can be represented. QoS, therefore, is
applied to aggregates of flows.
In contrast, IntServ is a fine-grained architecture. Resources are reserved in the
network for individual flows using a signalling protocol, namely, the Resource reSer-
Vation Protocol (RSVP) [73]. The Traffic SPECification (TSPEC) specifies the para-
meters for a leaky-bucket algorithm, such as the token arrival rate and bucket depth.
A flow A = {A(t), t = 0, 1, . . .}, where A(t) is the amount of traffic in the interval
[0, t], and conforms to the traffic specification function α if:
In order to support any degree of QoS, something must be known about the nature
of the flows entering the network so that resources can be allocated accordingly.
Consider a single server where packets arrivals are distributed according to a Poisson
distribution with mean rate λ. Furthermore, the number of packets serviced per unit
time is also Poisson distributed with mean rate µ. For a flow of traffic intensity ρ =
λ/µ, the probability that the backlog equals or exceeds n is ρn . For a traffic intensity
of ρ = 0.3, the J expression shows that the backlog diminishes exponentially with n:
12 1 Introduction
0.3ˆ(1 2 3 4 5)
0.3 0.09 0.027 0.0081 0.00243
The average delay for a single M/M/1 queue (where the M means Markovian) is
given by the expression:
1/µ
E[D] = (1.6)
1−ρ
Traffic flows in data networks, however, are not necessarily Poisson. Representing
traffic as a wide-sense increasing envelope curve lends itself to analytical treatment
using network calculus methods. For example, in Equations (1.4) and (1.5), α and
β represent arrival and service curves respectively. Given these two (wide-sense in-
creasing) curves, the upper bound for the backlog can be derived by the network
calculus result: max[α(s) − β(s)], ∀s ≥ 0. Bounds for delay and output traffic can
also be derived using network calculus, as will be discussed in detail in this book.
where the (x)+ is max(0, x) and q(0) = 0. Here, we show how to implement the
Lindley equation in J, such that we can examine the queuing dynamics of a work con-
serving link. The function requires two parameters; the initial queue size q(0), and
the arrival process over a (finite) sequence of discrete time intervals t = 1, . . . , N .
The J function qnext returns the backlog q(t + 1), and is defined thus:
1.4 Queue Analysis 13
Note that the terms: 0:, >., anext, +, qprev, - and c in the J expression above are all
functions. J supports a tacit programming style; that is, there is no explicit reference
to arguments. The built-in functions + and - are the addition and subtraction oper-
ators respectively. The larger-of function >., is also a built-in funtions, and returns
the argument with the greater value:
Note that the NB. construct denotes a comment. In order to make the qnext more
recognisable, we can define the max function, and redefine qnext, thus:
The function 0:3 is one of J’s constant functions, it returns a value zero, irrespective
of its arguments:
0: 1
0
The function anext (a(t+1)) returns the number of arrivals, qprev returns the backlog
(q(t)) and c is the capacity of the link. These functions will be defined shortly, but
first we must introduce a few more built-in J functions. We cannot make explicit
reference to arguments when programming tacitly, although we can access arguments
through the the functions left [ and right ] which return the left and right arguments,
respectively:
{: 0 1 2 3 4 5
5
3
In addition to 0: there are a number of corresponding integer constant verbs that range
from -9 to 9.
14 1 Introduction
qprev =: {:@]
Extracting the term a(t + 1) is more involved as we have to compute the index of
its position in the list a. We can calculate the value of t + 1 from the length of the
backlog vector. The tally function # gives the length of a list:
# 0 1 2 3 4 5
6
tnext =: #@]
The function ind decrements (with <:) the value returned by tnext:
ind =: <:@tnext
In J, elements in a list are indexed from zero, hence the need to decrement the value
of tnext. We can now extract the (t + 1)th element from a using the from function {
thus:
anext =: ind { [
Note that we do not need to use the “apply” operator @. This is due to the composition
rules of J. Finally we define the function c. In order to simplify this introductory
example, we use one of the constant functions. For a communications link with a
capacity of one, we use the expression:
c =: 1:
Excessive delays and dropped packets are a natural outcome of a best-effort service.
Any impact on an individual user’s “quality of service” is caused by other users shar-
ing the same networking resources. A degradation of service is a result of congestion
periods in the network.
Ideally, a network provider would wish to utilise network resources fully. The net-
work user, however, judges performance in terms of response time. High throughput
and low response time are conflicting requirements. This is primarily due to users’
demands for resources being unevenly distributed over time. We can use the Lindley
equation to explore queuing dynamics for various traffic types.
The function qnext computes q(t + 1); however an algorithm is required to perform
the operation over an entire arrival sequence. In J, this is fairly straightforward and
requires none of the conventional iteration constructs, such as for or while loops. Our
algorithm, which we will call lindley, is simply:
lindley =: ] , qnext
We pass the arrival sequence as the left argument to lindley and the backlog history
up to time t as the right argument. The backlog history up to time t + 1 is returned.
Consider a determinstic arrival process a1 of rate three:
a1 =: 3 3 3 3 3 3 3 3 3 3
c =: 3:
The first iteration of the lindley function, with backlog history q(0) = 0 is:
a1 lindley 0
0 0
For subsequent iterations, we can use the J power construct ˆ:. Functions can be
iterated N times by raising them to the power N , that is:
f 3 (x(0)) = f (f (f (x(0))))
Thus we can run the lindley function for ten iterations with the following command-
line:
a1 lindleyˆ:(10) 0
0 0 0 0 0 0 0 0 0 0 0
Not surprisingly, given the deterministic arrival rate a(t) = 3, ∀t, the backlog is
zero. Furthermore, the link is fully occupied. It would not be advisable to set the link
capacity any lower, as the backlog would grow, assuming an infinite queue, without
bound:
16 1 Introduction
c =: 2:
a1 lindleyˆ:(10) 0
0 1 2 3 4 5 6 7 8 9 10
Here we examine another, deterministic traffic arrival process. The “average” arrival
rate is still three, however; traffic arrives in bursts of six, followed by a period of
inactivity:
Traffic in excess of the capacity c = 3 is buffered until the next period. The next
time interval constitutes an off-period, so the link is able to clear the backlog. For
deterministic flows, setting the capacity for a given QoS is trivial. For example, if
for a2 we wish to set an upper bound of two for the backlog, then c needs to be set
to 4. Network traffic, however, tends to be stochastic. Given burst of traffic, it is not
so easy to predict that an off (or quiet) period will follow (or even if one will occur
soon). Consider the arrival sequence a3 :
a3 =: 3 5 2 4 5 2 3 1 3 2
The J expression below confirms that the average arrival rate of a3 is three:
+/ a3 % 10
3
The +/ is the summation function in J and % is divide. Run the lindley algorithm:
a3 lindleyˆ:(10) 0
0 0 2 1 2 4 3 3 1 1 0
A backlog builds up during persistent bursts (when a(t) > c). Eliminating the back-
log is relatively straightforward. We merely need to set the capacity of the link to the
peak rate of the flow, thus:
max a3
5
c =: 5:
a3 lindleyˆ:(10) 0
0 0 0 0 0 0 0 0 0 0 0
However, a zero backlog appears at a cost of overprovisioning the network. For much
of the time, network resources remain idle. If some backlog can be tolerated and
the network provider can accept some amount of idle capacity, then a compromise
solution may be reached by:
1.5 Summary 17
c =: 4:
a3 lindleyˆ:(10) 0
0 0 1 0 0 1 0 0 0 0 0
1.5 Summary
In this chapter, we present the basic concepts of J. We introduce some of J’s built-in
functions and show how they can be applied to data objects. The pricinpals presented
in this book are supported by examples. The reader therefore, is strongly advised to
download and install a copy of the J interpreter from www.jsoftware.com.
Here, we give a brief introduction to data objects in J. Data objects come in a number
of forms: scalars, vectors, matrices and higher-dimensional arrays. Scalars are single
numbers (or characters); the examples below show the values assigned to variables
names:
i =: 3 NB. integer
j =: _1 NB. negative integer
x =: 1.5983 NB. real
y =: 22r7 NB. rational
z =: 2j3 NB. complex number
m =: _ NB. infinity
n =: __ NB. negative infinity
v =: 5x2 NB. exponential notation 5 * exp(2)
Note that negative numbers are denoted by an underscore (_) preceding the value
rather than by a hyphen (-). An underscore on its own denotes infinity ∞, and two
underscores denotes negative infinity −∞. Variables are not limited to numerical
values:
c =: ’hello world’
Variables can be evaluated by entering the variable name at the command prompt:
20 2 Fundamentals of the J Programming Language
c
hello world
Scalars are called atoms in J or 0-cells, and vectors are called lists or 1-cells. The
sequence of numbers below is an example of a list and is assigned to a variable
name:
dvc =: 1 1 2 3 5 8 13 21 34 55
dvc
1 1 2 3 5 8 13 21 34 55
The i. verb generates ascending integers from zero n − 1, where n is the value of
the argument. For example:
Matrices (of ascending integers) can be generated with the i. verb. The example
below shows a 3 × 2 matrix:
Higher-dimensional arrays are also possible. The expression below generates an ar-
ray of reciprocals with ascending denominators:
2.2 J Verbs 21
%i. 2 4 3
_ 1 0.5
0.333333 0.25 0.2
0.166667 0.142857 0.125
0.111111 0.1 0.0909091
This 3-cell data object is a three-dimensional array with three columns, four rows
and two planes, where the planes are delimited by a blank line.
Scalars/atoms, vector/lists and matrices/tables are just special instances of arrays
with respective ranks zero, one and two. Table 2.1 shows the J terms for data objects
and their mathematical equivalents. Throughout this book, we will use the J and
mathematical terms interchangeably.
2.2 J Verbs
In J, functions are called verbs. J has a number of built-in verbs/functions; for exam-
ple, the basic arithmetic operators are: +, -, *, % and ˆ, which are addition, sub-
traction, multiplication, division and power functions, respectively. Here are some
(trivial) examples:
2 + 3 NB. addition
5
2 - 3 NB. subtraction
_1
7 * 3 NB. multiplication
21
2 % 7 NB. division: "%" is used instead of "/"
0.285714
22 2 Fundamentals of the J Programming Language
In J, there is a subtle (but important) difference between _1 and -1. The term _1 is
the value minus one, whereas -1 is the negation function applied to (positive) one.
Arithmetic can also be performed on lists of numbers:
The example above demonstrates how J deals with divide by zero. Any division by
zero returns a _ (∞). In addition to the basic arithmetic operators, J has many more
primitives, for example:
+: 1 2 3 4 NB. double
2 4 6 8
-: 1 2 3 4 NB. halve
0.5 1 1.5 2
%: 1 4 9 16 NB. square root
1 2 3 4
*: 1 2 3 4 NB. squared
1 4 9 16
>: _1 0 1 2 3 NB. increment
0 1 2 3 4
<: _1 0 1 2 3 NB. decrement
_2 _1 0 1 2
Verbs are denoted by either a single character (such as addition +) or a pair of charac-
ters (such as double +:). Some primitives do use alphabetic characters, for example,
the integers verb i. and complex verb j., which were introduced above.
Each verb in J possesses the property of valance, which relates to how many argu-
ments a verb takes. Monadic verbs take one argument (and are therefore of valance
one), whereas dyadic verbs take two arguments (valance two).
Monadic verbs are expressed in the form: f x. The (single) argument x is passed
to the right of the function f . In functional notation, this is equivalent to f (x). In its
dyadic form, f takes two arguments and are passed to the function on either side:
y f x, equivalent to f (y, x) in functional notation.
2.4 Positional Parameters 23
J’s verb symbols are overloaded; that is, they implement two separate (often related,
but sometimes inverse) functions depending upon the valance. We use the % primitive
to demonstrate. We have already seen it used in its dyadic form as a division operator.
However, in its monadic form, % performs a reciprocal operation:
Let us look at a few more examples. The monadic expression ˆx is the exponential
function of x: ex . The dyad yˆx, however, performs y to the power x, that is: y x . To
illustrate:
<: 1 2 3 4 5 6
0 1 2 3 4 5
4 <: 1 2 3 4 5 6
0 0 0 1 1 1
2 [ 3
2
2 ] 3
3
1
Similarly >: performs increment and greater-than-or-equal-to.
24 2 Fundamentals of the J Programming Language
]x =: i.10
0 1 2 3 4 5 6 7 8 9
The left verb can be used to execute two expressions on one line:
The verbs head {. and tail {: return the first element and the last element of a list:
{. x
0
{: x
10
Conversely, drop }. and curtail }: remove the head and tail of a list and return the
remaining elements:
}. x
2 4 6 8 10
}: x
0 2 4 6 8
The from verb { is used to extract a particular element (or elements) within a list, by
passing the index of the required element in the list as a left argument:
0 { x
0
2 { x
4
3 1 5 { x
6 2 10
0 0 0 1 2 2 2 3 3 4 5 5 5 5 { x
0 0 0 2 4 4 4 6 6 8 10 10 10 10
Lists can be combined with raze ,. and laminate ,: in columns or rows, respec-
tively. The J expressions below yield two matrices m1 and m2 :
]m1 =: 1 2 3 4 ,. 5 6 7 8
1 5
2 6
3 7
4 8
2.4 Positional Parameters 25
]m2 =: 1 2 3 4 ,: 5 6 7 8
1 2 3 4
5 6 7 8
2 { m1
3 7
1 { m2
5 6 7 8
Here, from returns the third row of m1 in the first example and the second row of m2
in the second example. If we wish to reference an individual scalar element, then we
need to use from twice:
0 { 1 { M2
5
In order to reference a column, we need to be able to change the rank of the verbs.
The concept of rank will be covered in the next section. Two data objects can be
concatenated with ravel (,), for example:
v1 =: 1 2 3 4
v2 =: 5 6
]v3 =: v1,v2
1 2 3 4 5 6
0 3 4 5 { v3
1 4 5 6
This creates a single list of eight elements (v3 ). There is no separation between the
two original lists v1 and v2 . If we wished to retain the separation of the two initial
lists, then we combine them with the link verb ;, for example:
]v4 =: v1;v2
+-------+---+
|1 2 3 4|5 6|
+-------+---+
The lists are “boxed” and therefore exist as separate data objects. We can reference
the two lists in the usual way:
0 { v4
+-------+
|1 2 3 4|
+-------+
26 2 Fundamentals of the J Programming Language
The data object returned is a single element; we cannot get at any of the individual
scalar elements in the box:
1 { 0 { v4
|index error
| 1 {0{v4
Use open > to unbox the object:
> 0 { v4 NB. unbox v1
1 2 3 4
1 { > 0 { v4
2
There is a corresponding inverse function, namely the monadic verb box <, which
“groups” elements:
<1 2 3 4
+-------+
|1 2 3 4|
+-------+
Using the primitives described above, we define a number of functions for referenc-
ing positional parameters. These functions will be used a great deal in developing
functions later in this book. Note that a couple of conjunctions are used here (& and
@) will be covered later, in Section 3.1.4
The functions lhs0 and rhs0 evaluate the left and right arguments, respectively.
The other functions are programmed to return positional parameters, thus lhs1
(respectively rhs1) returns the first positional parameter on the left-hand side
(respectively right-hand side). We illustrate the use of positional parameters with the
following example. Consider the classical M/M/1 queuing model given in
Equation (1.6). We can write a function that takes the parameters µ and ρ as left-hand
arguments and right-hand arguments, respectively:
2.5 Adverbs
The (default) behaviour of verbs can be altered by combining them with adverbs. We
have already encountered an adverb with the summation function +/. The applica-
tion of / causes + to be inserted between the elements of the argument, in this case,
the individual (scalar) numbers in the list.
The dyadic case results in a matrix of the sum of the elements of the left argument to
each element of the right argument.
(i.6) +/ (i.6)
0 1 2 3 4 5
1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
5 6 7 8 9 10
The prefix adverb \ causes the data object to be divided into sublists that increase in
size from the left; the associated verb is then applied to each sublist in turn. We can
see how the sublist is generated using the box verb:
<\ i.5
+-+---+-----+-------+---------+
|0|0 1|0 1 2|0 1 2 3|0 1 2 3 4|
+-+---+-----+-------+---------+
A cumulative summation function can be implemented using the insert and prefix
verbs:
+/\ i.6
0 1 3 6 10 15
This function will be useful later on when we wish to convert interval traffic arrival
processes to cumulative traffic arrival processes. The suffix \. operates on decreasing
sublists of the argument:
<\. i.6
+-----------+---------+-------+-----+---+-+
|0 1 2 3 4 5|1 2 3 4 5|2 3 4 5|3 4 5|4 5|5|
+-----------+---------+-------+-----+---+-+
28 2 Fundamentals of the J Programming Language
The monadic reflexive adverb ˜ duplicates the right-hand argument as the left-hand
argument. So the J expresssion f˜ x is equivalent to x f x, for example:
The ˜ verb also has a dyadic form (passive). This means that the left and right-hand
side arguments are swapped; that is, y f x becomes x f y, as an illustration:
Arithmetic can be performed between a scalar and a list or between two lists, for
example:
2 * 0 1 2 3 4 5
0 2 4 6 8 10
0 1 2 3 4 5 + 1 2 3 4 5 6
1 3 5 7 9 11
Notice that the lists have to be the same length; otherwise the J interpreter throws a
“length error”:
9 8 - 0 1 2 3 4 5
|length error
| 9 8 -0 1 2 3 4 5
]x2 =: 2 3 $ i.6
0 1 2
3 4 5
2.6 Rank, Shape and Arrays 29
As we have already seen, we could have defined this particular array, simply by:
i. 2 3
0 1 2
3 4 5
This is fine for defining an array with ascending integers (as returned by i.), but
if we wanted to form an array using some arbitrary list of values, then we need to
use $. We will continue to use the $ method, although we acknowledge that it is not
necessary, as the data objects used in these examples are merely ascending integers.
The shape is specified by the left arguments of $ and can be confirmed using the $
in its monadic form:
$ x2
2 3
The data object x2 is a (3×2) two-dimensional array, or, in J terms, a rank two object
(of shape 2 3). Arithmetic can be applied in the usual way. This example shows the
product of a scalar and an array:
2 * x2
0 2 4
6 8 10
Here we have the addition of two arrays (of the same shape):
x2 + (2 3 $ 1 2 3 4 5 6)
1 3 5
7 9 11
2 3 + x2
2 3 4
6 7 8
1 2 3 + x2
|length error
| 1 2 3 +x2
J of course, can handle this, but we need to understand more about the rank control
conjunction " which will be covered in Section 3.1 below. Consider a 3×2×2 array:
30 2 Fundamentals of the J Programming Language
]x3 =: 2 2 3 $ i.12
0 1 2
3 4 5
6 7 8
9 10 11
$ x3
2 2 3
+/ x3
6 8 10
12 14 16
Here, the individual elements of the two planes have been summed; that is:
012 6 7 8 0+6 1+7 2+8
+ =
345 9 10 11 3 + 9 4 + 10 5 + 11
6 8 10
=
12 14 16
It is important to understand why +/ sums across the planes rather down the columns
or along the rows. First consider this example:
% x3
_ 1 0.5
0.333333 0.25 0.2
Aside from the difference between the arithmetic functions +/ and % perform, they
also operate on the argument in a different way. Where as +/ operated on the two
planes, here % is applied to each individual scalar element. The difference in the
behaviour of the two verbs +/ and % is governed by their respective rank attributes.
We can query the rank attribute of verbs with the expressions below:
% b. 0
0 0 0
+/ b. 0
_ _ _
2.6 Rank, Shape and Arrays 31
Three numbers are returned. The first number (reading left to right) is the rank of the
monad form of the verb. The second and third numbers are the ranks of the left and
right arguments of the dyadic form of the verb. When a verb performs an operation
on an object, it determines the rank of the cell elements on which it will operate. It
does this by either using the rank (dimension) of the object or the rank attribute of
the verbs, whichever is smaller. In the example above, x3 has a rank of three, and the
(monadic) rank attribute of % is zero. So % is applied to x3 at rank zero. Thus it is
applied to each 0-cell (scalar) element. However, the rank attribute of +/ is infinite,
and, therefore, the rank, at which the summation is performed, is three. Thus, +/
applies to each 3-cell element of x3 , resulting in a summation across the planes.
Consider another example. We define the data object x0 as a list of six elements and
then apply the fork ($,#) which (simultaneously) returns the shape and the number
elements.
]x0 =: i.6
0 1 2 3 4 5
($;#) x0
+-+-+
|6|6|
+-+-+
Here both # and $ return six as x0 consists of six atoms, or 0-cell elements. Now try
this on x2 which was declared earlier:
($;#) x2
+---+-+
|2 3|2|
+---+-+
The resultant shape is as expected but the number of elements returned by tally may
not be. To make sense of the result, we need to know what “elements” the tally is
counting: 0-cell, 1-cell or 2-cell? This depends upon the rank at which # is operating.
The data object x2 is clearly rank two. The command-line below shows us that the
(monadic) verb attribute of # is infinite:
In this particular case we may ignore the dyadic rank attributes. Tally (#) is applied
to the 2-cell elements which are the rows. Consider this example:
]x1 =: 1 6 $ i.6
0 1 2 3 4 5
($;#) x1
+---+-+
32 2 Fundamentals of the J Programming Language
|1 6|1|
+---+-+
Data objects x0 and x1 may appear the same but they are actually different by virtue
of their shape and rank. x1 is a (6 × 1) two-dimensional array, and, therefore, of rank
two (with shape 1 6). It also has only one element (one row) because # still operates
on the 2-cell elements. In contrast, x0 is a list of six 0-cell elements. In actual fact,
x0 is equivalent to y0 , defined below:
]y0 =: 6 $ i.6
0 1 2 3 4 5
x0 = y0 NB. x0 and y0 are equivalent
1 1 1 1 1 1
x0 = x1 NB. but x0 and x1, as we know, are not
|length error
| x0 =x1
The difference between x0 and x1 becomes more apparent when we perform some
arithmetic operation on them:
x1 - x0
|length error
| x1 -x0
The interpreter is trying to subtract the first element from x1 from the first element
of x0 , then subtract the second element from x1 from the second element of x0 , and
so on. However, while x0 has six 0-cell elements, x1 only has one element, which
is a 2-cell. However it does not seem unreasonable to want to perform arithmetic
operations on x0 and x1 , as they both contain six numbers. We can control the rank
attribute of a verb, thereby enabling us to perform arithmetic on both x0 and x1 . We
will return to this example in Chapter 3 when we cover conjunctions.
2.7 Summary
Programming in J
New verbs can be defined from existing ones by combining them in sequences called
phrases. In this chapter, we focus on programming in J and describe in detail the rules
of composition. We begin by using J to explore the concept of z-transforms. This
exercise serves as a brief introduction to composition contructs and conjunctions.
Subsequent sections cover these concepts in greater detail.
The z-transform converts discrete signals in the time domain into a complex fre-
quency time domain. The z-transform involves the summation of an infinite series of
reciprocals of z −n [41]:
∞
Z{x[n]} = x[n]z −n (3.1)
n=0
The J expression below implements the z-transform in Equation (3.3) for u[n]:
The expression above consists of a two verb phrase (enclosed in brackets) followed
by an argument z. The pair of verbs, namely, % and <:, form a compositional con-
struct called a hook. The J interpreter parses the phrase right to left. The argument
34 3 Programming in J
z undergoes a transformation by the first verb (reading from the right). The second
verb is then applied to the argument and the transformation. Thus, all the values in z
are decremented by <:, then the division operator % is applied, where the numerator
is z and the denominator is the result of the decrement operation (z − 1).
The step verb can be implemented by the mathematical function less-than-or-equal-
to, where a value of one is returned if true, and zero otherwise. In J, the <, +. and
= are the less-than, or and equals-to verbs, respectively. Thus, the phrase in the
expression below implements the step1 function for n = 3:
n =: i.10
3 (<+.=) n
0 0 0 1 1 1 1 1 1 1
The unit step function u[n] in Equation (3.2) is realised by invoking step with a left
argument of zero. The unit step function can be defined by attaching the constant 0
to the step function:
ustep =: 0&step
ustep n
1 1 1 1 1 1 1 1 1 1
n =: i.100
+/ (ustep * z&ˆ@-) n
2 1.5 1.33333 1.25 1.2 1.16667
Note the use of the bind conjunction again, whereby the term z&ˆ forms a z-to-
the-power verb. Another conjunction is also used, namely atop @. The composition
of one verb atop another, constitutes a transformation of a transformation. Here, the
z-to-the-power verb is applied atop the negation - yielding the mathematical term
z −n .
1
We implement the step function in this way merely for illustration, J provides a built-in
less-than-or-equal-to verb: <:.
3.1 Verb Composition 35
3.1.1 Hooks
A sequence of two verbs forms a hook. If f1 and f2 are verbs, then the monadic
phrase: (f1 f2) x, where x is an argument, is equivalent to the function
expression: f1 (x, f2 (x)). The verb f2 performs a monadic operation on x. Then f1
performs an operation on the result of x and f2 (x). The function f1 behaves as a
dyad, as it operates on two “arguments.” To illustrate this we provide a number of
examples. The hook below implements the expression x2 + x:
Each value in x is squared (by *:). This result is then added to the vector x; thus the
expression above is equivalent to:
{0 + 0, 1 + 1, 4 + 2, 9 + 3, 16 + 4, 25 + 5}
In the following example, each value of x is doubled (+:) and then multiplied by x,
which is equivalent to x × 2x, or 2x2 :
The dyadic form of the hook is given by: y (f1 f2) x, where x and y are argu-
ments. Here, f2 performs a monadic operation on x. Then f1 performs a dyadic
operation on y and the result of f1 (x). Expressed in functional notation, the dyadic
hook is equivalent to: f1 (y, f2 (x)).
√
The example below implements the expression y + x:
y =: 2
y (+%:) x
2 3 3.41421 3.73205 4 4.23607
36 3 Programming in J
3.1.2 Forks
The tally verb # returns the number elements in the vector x (in this case 6). The +/
returns the summation of x. Then the verb % is applied to the result of verbs +/ and
#, thus dividing the sum of the elements by the number of elements. Note that, here,
% is applied dyadically, so it performs a division function rather than the (monadic)
reciprocal form of the verb.
The example below shows a dyadic fork. The expression yx − y/x can be imple-
mented by:
y (*-%) x
__ 0 3 5.33333 7.5 9.6
To reiterate, phrases are evaluated right to left. The hook and fork rules of composi-
tion are applied. Consider the example below:
(-+/%#) x
_2.5 _1.5 _0.5 0.5 1.5 2.5
A fork is formed by the three primitives: +/%# which, as we saw above, implement
the arithmetic mean. This, in turn, forms a hook with -. We can make the example a
little clearer if we define an arithmetic mean verb:
We can see that - and mean form a hook, which subtracts x (the mean of x) from
each element of x; that is, xi − x. The phrase -mean implements the deviation-from-
mean function.
3.1 Verb Composition 37
3.1.4 Conjunctions
In this section, we discuss verb composition with conjunctions. The bond verb &
is used to combine verbs and nouns to form new verbs. For instance, if ˆ. is used
monadically, it performs the natural logarithm function (ln); dyadically, however, it
performs the logarithm to the base of left argument. This is illustrated in the example
below:
For convenience, we can define the verb log2 by binding the 2 to verb ˆ., that is:
Here the literal 2 is bonded to ˆ. to form a new verb which, used monadically, gives:
log2 1 2 4 10 100
0 1 2 3.32193 6.64386
The & conjunction can also be used to combine verbs. Used in this way it is called
the compose conjunction. In functional notation, the dyadic phrase (f1&f2) x, is
equivalent to f1 (f2 (x), f 2(x)). For the dyadic form of the phrase: y (f1&f2) x
the functional equivalent is f1 (f2 (y), f2 (x)). Consider the use of not verb -. in the
example below which produces a list on integers between three and nine:
(i.10) -. (i.3)
3 4 5 6 7 8 9
This can be achieved with the phrase below, where we pass the bounds of the list as
parameters, though the value of the left argument is not included in the list. Thus:
10 (-.&i.) 3
3 4 5 6 7 8 9
38 3 Programming in J
The to verb, defined below, is a useful function for generating a list of integers from
the value of the left argument to the value of the right agrument:
to =: -.&i.˜,]
3 to 10
3 4 5 6 7 8 9 10
The passive adverb allows us to reverse the arguments and the right verb ] ensures
the right argument is included in the list.
The atop conjunction @ (and related at conjunction @:) provide a means of combin-
ing verbs in sequence. Consider the monadic phrase in the form: (f1@f2) x. The
verb f2 is applied monadically to x, then f1 is applied monadically to the result. In
functional notation, this is equivalent to: f1 (f2 (x)).
Suppose we wish to compute the arithmetic mean and then negate the result. We can-
not use the expression −mean, as this forms a hook between the - and mean verbs.
As demonstrated above, this returns the deviation from the mean; that is xi − x,
whereas the operation we actually want is −x. The hook causes the - to behave
dyadically and thus performs subtraction. The atop conjunction @ alters the compo-
sitional rules between - and mean, such that - is applied monadically to the result
of mean. The phrase below gives the desired result:
(-@mean) x
_3.5
If the at conjunction is used instead, we get, in this case, the same result:
(-@:mean) x
_3.5
While the atop and at are similar, they do have a subtle but important difference.
Suppose we wish to sum a list of reciprocals:
i=n
1
(3.4)
x
i=1 i
(+/@%) x
1 0.5 0.333333 0.25 0.2 0.166667
However, this has not performed the operation Equation (3.4). In Section 2.6, we
saw that the +/ had an infinite monadic (and dyadic) rank and, therefore, should
have operated across the entire object. However +/ has combined with %, which has
a (monadic and dyadic) rank of zero:
3.1 Verb Composition 39
% b. 0
0 0 0
For the phrase: f1@f2, f1 inherits the rank of f2 . Thus, for (+/@%), +/ inherits
the rank of zero from -. This can be confirmed by:
(+/@-) b. 0
0 0 0
The at conjunction performs the same sequencing operation as atop, but without rank
inheritance:
(+/@:-) b. 0
_ _ _
The J expression below confirms that the phrase operates at the desired rank and
correctly performs the operation in Equation (3.4):
(+/@:%) x
2.45
The phrase below shows the atop conjunction used in dyadic form: y (f1@f2) x.
In functional notation, this is equivalent to f1 (f2 (y, x)). The arguments y and x are
operated on by f2 , which behaves as a dyad, f1 then operates monadically on the
result. The dyad below implements the expression 2y/x:
y (+:@%) x
_ 4 2 1.33333 1 0.8
Sometimes it is necessary to override the rank of a verb. Let us return to the example
of the three dimensional array x3 from Section 2.6. We redefine x3 below:
]x3 =: i. 2 2 3
0 1 2
3 4 5
6 7 8
9 10 11
Recall that, when we applied +/ to x3 , it summed the elements across the planes:
+/ x3
6 8 10
12 14 16
40 3 Programming in J
If we wish to sum x3 along the rows, we need to explicitly specify the rank attribute
of the verb with the " conjunction:
+/"1 x3
3 12
21 30
Here the (monadic) rank attribute has been explicitly set to one. This can be con-
firmed by:
+"1 b. 0
1 1 1
It is important that the rank attribute of +/ has not been changed. A new verb has
been formed, one which performs the summation of the rows of, in this case, a matrix.
To sum down the columns set the rank attribute to two:
+/"2 x3
3 5 7
15 17 19
Also, from Section 2.6, we can re-examine the addition of the two-dimensional array
x2 to a three element list. Redefine x2 :
]x2 =: i. 2 3
0 1 2
3 4 5
1 2 3 + x2
|length error
| 1 2 3 +x2
1 2 3 +"1 x2
1 3 5
4 6 8
We illustrate gerund and agenda with the following example. The function x = 2t+1
can be implemented with the J expression:
3.2 Examples 41
(>:@+:) i:5
_9 _7 _5 _3 _1 1 3 5 7 9 11
The function (0&<:) acts as a condition statement, returning one if the argument is
greater than zero and zero otherwise:
(0&<:) i:5
0 0 0 0 0 1 1 1 1 1 1
The first function in the list is invoked if the condition statement returns a zero,
which in this case is the constant function 0:. The next function is invoked, in this
case (>:@+:), if one is returned.
Note the use of the &>. This ensures that the phrase is applied to each element in the
list. From the expression below we can see that the phrase in question has infinite
rank and, therefore, does not apply at the 0-cell level as we wish:
0: ‘(>:@+:) @. (0&<:) b. 0
_ _ _
We can avoid setting the rank by using each construct &>. This method is frequently
used in this book.
3.2 Examples
We continue with the z-transforms in the introduction to this chapter. The unit im-
pulse function is closely related to the unit step function (Equation (3.2)), where u[n]
is the running sum of δ[n].
∞
u[n] =: δ[n] (3.6)
n=0
n =: i.10
uimpls n
1 0 0 0 0 0 0 0 0 0
The z-transform for δ[n] is 1 ∀z. The implementation of the z-transform for the δ[n]
function is trivial, as we can just use the 1: constant verb:
z =: 1 2 3 4 5 6
1: &> z
1 1 1 1 1 1
The transform in Equation (3.1) is realised by the J expression below. It confirms that
the δ[n] function yields a value of one:
n =: i.100
+/ (uimpls * z&ˆ@-) n
1 1 1 1 1 1
n =: 100
+/ (a&ˆ * ustep * z&ˆ@-) n
3 2 1.66667 1.5 1.4 1.33333
3.2 Examples 43
Consider the example of Shannon’s result for the maximum channel capacity C [62]:
S
C = W log2 1 + (3.8)
N
where W is the bandwidth of the channel and S/N is the signal to noise ratio. For a
bandwidth W = 3100 Hz and signal to noise ration S/N = 1000 : 1 (30 dB), the
channel capacity C is given by the J expression:
Thus, the channel capacity C is approximately 30.9 kb/s. The increment verb >:
adds one to the right argument, which, in this case, is the signal to noise ratio S/N =
1000. The verb log2 is applied to the result of >: using the atop conjunction. Finally,
the * verb performs the multiplication function between the left argument (W =
3100) and the result of log2 .
Euler’s formula [59] demonstrates the relationship between the exponential function
and the trigonometrical functions:
The complex verb j. multiplies its argument by 0j1 so we can implement (the right
hand side of) Euler’s formula as:
eu1 =: cos+j.@sin
eu1 th
1 6.1232e_17j1 _1j1.2247e_16 _1.837e_16j_1 1j_2.4493e_16
However, with J, we can implement Euler’s formula from the left-hand side of
Equation (3.9):
44 3 Programming in J
eu2 =: ˆ@j.
eu2 th
1 0j1 _1 0j_1 1
From these results, eu1 and eu2 may not appear equivalent, but closer examination
reveals that they (nearly) are. The problem is that eu1 has suffered precision error and
returned very small values for results that should actually be zero. For this reason,
eu2 is favoured over eu1:
eu =: ˆ@j.
Moreover, this solution is far more elegant, and quite fitting, as Euler’s formula is
considered to be one of the most beautiful mathematical equations. To conclude this
example, we demonstrate Euler’s identity:
eiπ + 1 = 0 (3.10)
where p(i) is the probability of symbol i occurring. We need the log2 function that
was defined earlier. We define p0 and p1 as probability distributions for a signal that
comprises four distinct symbols:
]p0 =: (#%) 4
0.25 0.25 0.25 0.25 NB. equal probability
]p1 =: 0.1 0.2 0.5 0.2
0.1 0.2 0.5 0.2
We will develop the function in stages, so that we can show how it works. First
multiply p1 (i) by log2 p1 (i):
3.3 Good Programming Practice 45
(*log2) p1
_0.332193 _0.464386 _0.5 _0.464386
i=n
Then sum the resultant terms ( i=1 p1 (i) log2 p1 (i)):
(+/@:*log2) p1
_1.76096
(-+/@:*log2) p1
1.76096
entropy =: -+/@:*log2 NB. define entropy
We can compute Hmax by applying entropy to p0, the probability distribution for
when all symbols are equally likely:
We can compute the amount of redundancy Hmax − H for a particular signal (in this
case with probability distribution p):
-/@entropy p0,.p1
0.239036
where x is the arithmetic mean. One implementation of the sample variance in J is:
var1 =: <:@#%˜+/@(*:@-+/%#)
var1 i.6
3.5
There are a couple of issues relating to this verb. Firstly, it is virtually unreadable.
Secondly, it is very difficult to debug, as this is just one function made out of nine
primitives and four conjunctions. In short, this is not how to write J code! In this
46 3 Programming in J
respect, J is like any other programming language; it is quite easy to write unreadable
code that is difficult to debug.
Here, we rewrite the variance function. In Subsection 3.1.3 we showed a phrase that
implemented a deviations-from-mean function. We define it thus:
The resulting function var2 shows that the variance is merely the sum of square
deviations divided by the degrees of freedom:
var2 =: sumsq%dof
var2 i.6
3.5
Furthermore, the standard deviation σ is just the square root (%:) of the variance:
std =: %:@var2
std i.6
1.70783
It can be seen that breaking down (complex) J functions into smaller ones aids read-
ability. Furthermore, each component function can be tested, making debugging eas-
ier. As a rule of thumb, do not use more than four functions to implement any other
function. Despite the benefits of breaking functions down into smaller functions there
is one drawback, and that is the necessity that (sub) function names are unique. As
the number of functions we develop grows the greater the chance that two functions
names will clash. In the next subsection we introduce locales as a means of avoiding
clashes in the name space.
3.3 Good Programming Practice 47
3.3.1 Locales
Functions can be organised into modules or locales. Verb names need only be unique
within the locale, which helps to avoid name space clashes. In the example below,
we define two verbs with the same name: f1 . An extra identifier is appended to verbs
to denote the locale.
f1_myloc_ i.6
0 2 6 12 20 30
f1_newloc_ i.6
0 0.5 2 4.5 8 12.5
However, this is only because we are not in either the myloc or newloc locales. The
default locale is called base We can verify the locale we are in by the following
(somewhat obscure) command:
18!:5 ’’
+----+
|base|
+----+
cocurrent <’myloc’
Now, when we reference any verb defined within this locale, we do not need to
include the locale name as part of the function name:
f1 i.6
0 2 6 12 20 30
Just to verify that we are indeed in the myloc locale. The phrase below returns the
current locale:
18!:5 ’’
+-----+
|myloc|
+-----+
48 3 Programming in J
cocurrent <’newloc’
f1 i.6
0 0.5 2 4.5 8 12.5
If we define a new verb f2 here (omitting the locale designation), then f2 will be in
the newloc locale:
f2 =: 5&*
f2 i.6
0 5 10 15 20 25
We can define and reference f2 without explicitly specifying the locale; but if we
then return to the base locale, references to f2 require the locale:
cocurrent <’base’
f2 i.6 NB. f2 not defined in ’base’ locale
|value error: f2
| f2 i.6
f2_newloc_ i.6
0 5 10 15 20 25
In addition to the base locale, there is the z locale, which is appended to the search
path of the current locale. When a verb is referenced without an explicit locale qual-
ification, J searches for it in the current locale (either the base locale of the locale
specified by the cocurrent directive). If it is not found, then the z locale is searched.
Typically the z locale is used to hold standard utilities. The convention used in this
book is to write a complex function as a series of subfunctions. These subfunctions
are defined in some new locale. The actual function is defined in the z locale and
references its subfunctions using an appropriate locale qualification. Any “wrapper”
functions are defined in the z locale. Wrapper functions are discussed in the next
subsection where we deal with explicit programming.
The verb composition methods covered so far in this book are refered to as tacit
programming. With tacit programming, there is no explicit reference to arguments. J
does, however, allow explicit programming methods where arguments are explicitly
referenced. The verb definition below implements an explicit addition function:
The literal argument 4 specifies that the verb definition is dyadic (3 specifies
monadic). Here we use explicit reference names, namely x., which is the left ar-
gument and y., which is the right argument. Explicit programming also allows for
conventional programming constructs like branches (if statements) and flow-control
(for and while loops). Here is a conventional definition of the summation function:
sum =: 3 : 0
n =. 0 [ total =. 0
for_k. y.
do.
total =. total + k
end.
total
)
Check that sum yields the same result as +/ with the expression:
(+/;sum) i.6
+--+--+
|15|15|
+--+--+
3.4 Scripts
Verb definitions are lost when the J session is closed down. Verbs definitions can
be preserved by storing them in a script file. When the J interpreter is started, the
scripts can be loaded in. Create a file fscript.ijs that contains the following function
definitions:
f i.6
|value error: f
| f i.6
As this is a new J session, any previous function definitions will be lost. However,
they can be restored by loading fscript.ijs:
load ’fscript.ijs’
f i.6
0 1.5 5 10.5 18 27.5
3.5 Summary
Network Calculus
a1 =: 3 5 2 4 5 2 3 1 3 2
For reasons that will become apparent later, it is convenient to define A1 (t) as func-
tion instead of as a data object. We can use the seq verb thus:
A1 3
10
Using the CBR (constant bit rate) link example in Section 1.4, A1 (t) is bounded by
f (t) = ct, that is A1 is c-uppper constrained iff:
Here, we show how to use J to analyse the characteristics of traffic flows. We define
the time index terms t and s as verbs:
t_z_ =: ]
s_z_ =: i.@>:@t
hd1 =: ’t’;’s’;’t-s’
hd1,: (t;s;t-s) 10
+--+----------------------+----------------------+
|t |s |t-s |
+--+----------------------+----------------------+
|10|0 1 2 3 4 5 6 7 8 9 10|10 9 8 7 6 5 4 3 2 1 0|
+--+----------------------+----------------------+
c =: 3:
We can realise the inequality in Equation (4.2) with the following expression:
The result shows that A1 is c-upper constrained over the interval [0, t] for t = 10.
Indeed, the mean rate of the flow A(t)/t = 3, is equivalent to the speed of the CBR
link. However, for A1 , traffic does not arrive at a constant rate. For example, the flow
is not c-upper constrained when t = 5:
We can see from the expression below, ∀t and c = 3, A1 (t) is not c-upper cons-
trained:
A CBR link does not allow for bursts of traffic above the peak rate function. The
amount of traffic that departs from the link at any time interval t is bounded by the
peak rate. That is, traffic A(t) − A(t − 1) in excess of c is buffered (or dropped) at
the link. This is a consequence of operating a CBR link at the mean arrival rate of
the flow. Backlog can be avoided by operating the link at the peak rate of the traffic
flow. The peak rate of A1 is derived:
c =: 5:
*/@ ((A1@t-A1@s) <: c*(t-s)) &> i.11
1 1 1 1 1 1 1 1 1 1 1
Traffic flows are typically bursty, such that operating a link at the peak rate of the
flow, typically results in the link being underutilised. Leaky bucket algorithms can
be used to characterise VBR (variable bit rate) flows. A leaky-bucket is defined in
terms of a rate ρ and burst tolerance σ. Thus an arrival curve f is given by:
f (t) = ρt + σ (4.3)
rho =: 3:
sigma =: 4:
f =: 0&<* sigma + rho*t
The 0&<* term ensures f (0) = 0. From the J expression below, it can be seen that
the inequality in Equation (4.4) is satisfied:
We have shown that we can characterise bursty traffic as a CBR or VBR flow. A1 is
bounded by a CBR flow where the rate c is set to the flow’s peak rate, hence c = 5.
As a VBR flow, A1 is bounded rate ρ = 3 (which is the flow’s mean rate) and a burst
tolerance of σ = 4. Other arrival curves also bound A1 :
rho =: 4:
sigma =: 1:
*/@ ((A1@t - A1@s) <: f@(t-s)) &> i.11
1 1 1 1 1 1 1 1 1 1 1
Network calculus applies system theory to the problem of analysing traffic flows
within networks. When system theory is used to analyse electronic circuits, con-
ventional algebra (R, +, ×) can be used. However, when analysing network flows,
min-plus algebra is adopted. With min-plus algebra, addition is replaced by min and
the product is replaced by plus. In conventional algebra, the output signal y(t) ∈ R
of a circuit is the convolution of the input signal x(t) ∈ R and impulse response of
the circuit y(t) ∈ R. Thus the convolution y ⋆ x, is given by:
(x ⋆ y)(t) = x(s) · y(t − s)d(s) (4.5)
0≤s≤t
• commutivity
a⊕b=b⊕a
a⊗b=b⊗a
• associativity
(a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)
(a ⊗ b) ⊗ c = a ⊗ (b ⊗ c)
• distributivity
(a ⊕ b) ⊗ c = (a ⊗ c) ⊕ (b ⊕ c)
We demonstrate these three properties for the min (⊕) operator in J (the ⊗ operator
is also commutative, associative and distributive). The expressions below return a
one if the equality is met and zero otherwise. Commutative property:
3 min 2 = 2 min 3
1
Associative property:
Distributive property:
Matrix operations can also be performed under min-plus algebra. Thus, for the oper-
ation P ⊕ Q, we have:
p1 q1 min[p1 , q1 ]
⊕ = (4.7)
p2 q2 min[p2 , q2 ]
P =: 1 4
Q =: 2 3
P min"0 Q
1 3
In regular algebra, the inner product function is implemented by the phrase (+/.*).
The equivalent inner-product operation in min-plus algebra is (min"1 .+). The
min-plus inner-product is illustrated below:
56 4 Network Calculus
]M =: i. 2 2
0 1
2 3
P (min"1 .+) M
1 5
f1 =: 0&<* (4: + t)
g1 =: 0&<* (3: * t)
(f1 ,: g1) i.11
(f1 ,: g1) i.11
0 5 6 7 8 9 10 11 12 13 14
0 3 6 9 12 15 18 21 24 27 30
There are two ways of expressing Equation (4.11) in J. We illustrate with functions
f1 and g1 :
or:
In this particular case f1 ⋆ g1 = min[f1 , g1 ]. We can show that both operations are
commutative, that is: f ⊕g = g ⊕f and f ⋆g = g ⋆f . We demonstrate commutativity
in the pointwise minumum:
h1 =: 0&<* (1: + 2: * t)
h1 i.11
0 3 5 7 9 11 13 15 17 19 21
(f ⊕ g) ⋆ h = (f ⋆ h) ⊕ (g ⋆ h) (4.12)
Here, we show the right-hand side of Equation (4.12) is equivalent, which confirms
the distrbutive property:
Consider the two sequences ǫ and e, where ǫ(t) = ∞ ∀t while e(0) = 0 and e(t) =
∞ ∀t > 0. Then ǫ is the absorbing element, such that:
f ⋆ǫ=ǫ⋆f =ǫ (4.13)
f ⋆e=e⋆f =f (4.14)
(e,:et) i.11
0 _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _
We demonstrate the absorption and identity properties of Equations (4.13) and (4.14)
using the function f1 :
One of the differences of min-plus algebra and regular algebra is the idempotency of
addition, We show that f = f ⊕ f with the J expression:
There are a number of function types that are important to min-plus algebra, namely:
In this section we, examine the properties of these functions using J. We also intro-
duce the concept of subadditive closure.
4.3 Mathematical Background 59
f2 =: *ˆ@-
g2 =: %>:
However, g2 is:
We have shown how peak rate and affine functions can be defined using the constant
verbs (1:, 2:, 3: etc). This was done for convenience and served its purpose for
illustrating the fundamental concepts of min-plus algebra. However, the practice is
somewhat restrictive for any serious analysis. Defining wide-sense increasing func-
tions that accept parameters greatly increases analytical flexibility. In this section we,
define parametric peak rate and affine curve verbs. We also introduce other curves
that are used in network calculus. We define a verb that, when applied, ensures a
function belongs to F0 , thus:
pr_z =: F0 * *
5 pr i.11
0 5 10 15 20 25 30 35 40 45 50
f3 =: 5&pr
Affine Function
The affine curve γr,b takes two parameters, the rate r and tolerance b, and is given
by:
rt + b if t > 0
γr,b (t) = (4.17)
0 otherwise
af_z_ =: F0 * max0@(lhs2+lhs1*rhs0)
Burst Delay
bd_z_ =: F0*_:
3 bd i.11
0 0 0 0 _ _ _ _ _ _ _
4.3 Mathematical Background 61
Rate-Latency
where parameters R, T are the rate and latency, respectively. The J verb definition is:
rl_z_ =: lhs1 * max0 @ (rhs0-lhs2)
The rate-latency function β3,2 yields the following result:
3 2 rl i.11
0 0 0 3 6 9 12 15 18 21 24
Step Function
Stair Function
The stair function uT,τ takes two parameters, T and τ , where T > 0 and tolerance
0 ≤ τ ≤ T . The expression for the stair function is given by:
t+τ
⌈ T ⌉ if t > T
uT,τ (t) = (4.21)
0 otherwise
f4 =: %: NB. sqrt(t)
g4 =: *: NB. tˆ2
whereas g is not:
h4 =: >:@f4
(h4@t = min@(h4@s + h4@(t-s))) &> i.10
0 0 0 0 0 0 0 0 0 0
(h4@t <: min@(h4@s + h4@(t-s))) &> i.10
1 1 1 1 1 1 1 1 1 1
v_z_ =: }.@i.@t
stop_z_ =: 2&<.
conv_z_ =: min@(f, close"0@v + close"0@(t-v))
close_z_ =: (0: ‘ f ‘ conv @. stop)"0
For the purpose of illustration, we use the peak rate function f3 = λ3 defined earlier:
f =: f3
In this case, we can see that f3 is equal to its subadditive closure. Now consider the
function g4 = t2 defined earlier:
64 4 Network Calculus
g4 i.11
0 1 4 9 16 25 36 49 64 81 100
f =: g4
close &> i.11
0 1 2 3 4 5 6 7 8 9 10
In this case, the subadditive closure of g4 is less then or equal to g4 itself, that is
g4∗ = t. We can verify that the subadditive closure of g4 is indeed subadditive even
though g4 is not:
w_z_ =: [
i01_z_ =: %(>./@:|)
i01 i.6
0 0.2 0.4 0.6 0.8 1
The expression below shows that Equation (4.25) holds, and therefore f4 is concave:
x1 >: y1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
Chang [10] and Le Boudec and Thiran [36] introduce the properties of star-shaped
functions. Function f is star-shaped if f (t)/t is wide-sense decreasing ∀t > 0. Con-
cave functions are star-shaped. Thus:
2 5 $ (f4%t) 1 to 10
1 0.707107 0.57735 0.5 0.447214
0.408248 0.377964 0.353553 0.333333 0.316228
66 4 Network Calculus
Note the shape term 2 5 $ is used merely for brevity, it arranges the output into
a 2 × 5 matrix so that the values may be displayed on the page. The rate latency
function β3,2 , which is not concave, is not star-shaped:
3 2 (rl%t) 1 to 10
0 0 1 1.5 1.8 2 2.14286 2.25 2.33333 2.4
We can see that the two functions f3 (t) = λ3 (t) and g3 (t) = γ3,4 are star-shaped:
((f3%t) ,: (g3%t)) 1 to 10
5 5 5 5 5 5 5 5 5 5
7 5 4.33333 4 3.8 3.66667 3.57143 3.5 3.44444 3.4
One of the properties of star-shaped functions is that if f and g are star-shaped then
so is min(f, g). We define h3 as the pointwise minimum of f3 and g3 :
(h3%t) 1 to 10
5 5 4.33333 4 3.8 3.66667 3.57143 3.5 3.44444 3.4
In Section 4.1, we showed how to characterise traffic flows. We say that, for f ∈ F,
a flow A is f -upper constrained if:
f5 =: 3&pr
We defined the flow sequence A1 in Section 4.1, and we know that A1 is not f5 -upper
constrained. Thus, traffic will be buffered at the link causing a backlog, which is
given by:
q(t) = max (A(t) − A(s) − f (t − s)) (4.28)
0≤s≤t
Chang [10] gives a formal proof by induction. Here, we merely demonstrate that they
are equivalent by showing that Equations (4.28) and (4.29) give the same result for
the example here. The verb for the Lindley equation is (re)defined in Listing 4.1.
The link capacity is passed to the lindley function as an argument (on the left-hand
side) along with the sequence of arrivals a. Note that a(t) = A(t) = A(t − 1). We
defined a1 in Section 4.1, but we can derive it from A1 with the expression:
For convenience, we pass the capacity and the backlog at t = 0 as literals (that is,
c = 3 and q(0) = 0) to the lindley function. We show that Equations (4.28) and
(4.29) are indeed equivalent:
Consider the following example. Given the arrival sequence A1 and CBR link oper-
ating at a rate f5 = λ3 , the output B1 is:
Assume that there are two CBR links, CBR0 and CBR1 (see Fig 4.2) connected
in series (by a multiplexer which causes no delay) both operating at a rate R = 3
(f5 = λ3 ). We have seen from the example above that the output of CBR0 is B1 for
a flow with an arrival sequence A1 . The arrival sequence A2 = B1 is the input to the
second link, CBR1. We define the sequence A2 in J:
A2 =: B1&seq
CBR0 has a shaping effect on the traffic flow A1 . In this particular case, shaping is
merely a consequence of the link’s capacity and the buffering mechanism. However,
traffic shaping is a common technique for modifying the characteristics of a flow,
such that it conforms to a specific set of traffic descriptors. Shaping can be used to
reduce the backlog (and delays) at a communication link. Suppose we send the flow
A1 through a leaky bucket shaper, which shapes the incoming flow according to the
rate and burst tolerance traffic descriptors r = 3 and b = 1, respectively. Figure 4.3
shows the shaper VBR0 connected to CBR1. Define g5 = γ3,1 :
g5 =: 3 1&af
The output from the shaper VBR0 B3 and the arrival flow into CBR1 A3 is:
4.4 Arrival Curves 69
The verb gclipper operates explicitly on the arrival sequence A and shaping function
g, thus:
A_CLIPPER_ =: 0 3 7 10 13 16 19 22 25 28 30&seq
g_CLIPPER_ =: 3 1&af
]B5 =: gclipperˆ:(10) 0
0 3 7 9 13 16 18 21 22 25 27
A4 =: B5&seq
]q5 =: max@((A4@t - A4@s) - f1@(t-s)) &> i.11
0 0 1 0 1 1 0 0 0 0 0
It can be seen that, for the same traffic descriptors, the backlog at CBR1 is less when
using the g-clipper than the g-regulator. This performance gain, however, has to be
traded for some loss of traffic.
4.5 Service Curves 71
In order to provide guarantees to flows, the nodes must make resource reservations
within the network. This function is carried out by packet schedulers. A packet
scheduler is said to offer a service curve f for some 0 ≤ t0 ≤ t if:
where B(t) is the backlog at time t and t0 is the start of the busy period. The backlog
is zero at t0 . It follows, then, that B(t0 ) − A(t0 ) = 0, and Equation (4.32) can be
rewritten:
B(t) − A(t0 ) ≥ f (t − t0 ) (4.33)
This is equivalent to B ≥ A ⋆ f , or:
For the purpose of illustration, consider a CBR link, which guarantees that a flow will
receive a service of rate R = 3, which we can represent using the function f5 = λ3 ,
defined earlier. Suppose that the node for CBR link introduces a maximum delay of
three. We use the Burst-delay function f6 = δ3 to represent the latency in the node:
f6 =: 3&bd
The overall service curve is given by the convolution of the two service curves: h1 =
f5 ⋆ f6 . For convenience, we assume t0 = 0, thus:
h1 =: min@(f5@s+f6@(t-s))
h1 &> i.11
0 0 0 3 6 9 12 15 18 21 24
4.5.1 Concatenation
Suppose we have two nodes, each offering rate-latency service curves βR0 ,T0 and
βR1 ,T1 , respectively. The combined rate-latency curve βR0 ,T0 ⋆βR1 ,T1 is the concate-
nation of the two systems; that is: βmin(R0 ,R1 ),T0 +T1 . To illustrate this, we define the
functions f8 = β3,2 and f9 = β4,1 :
f8 =: 3 2&rl
f9 =: 4 1&rl
72 4 Network Calculus
Given that a flow arriving at a node is f -upper and the node offers a service curve g,
we can compute the bounds for backlog, delay and output. For illustration, we will
use an arrival curve f10 = γ3,3 and service curve g6 = β6,3 :
The respective curves for f10 and g6 are shown in Fig 4.5.
Backlog
max@(f10@s - g6@s) 10
12
Delay
The expression below generates a table showing f10 (s) and g6 (s + τ ) for different
values of τ .
4.5 Service Curves 73
40
service curve
●
30
●
traffic
●
20
arrival curve ●
●
10
●
0
0 2 4 6 8 10
tau_z_ =: lhs0
(i.7) (tau; (f10@s ,: g6@(s+tau)))"0 (10)
+-+--------------------------------+
|0|0 6 9 12 15 18 21 24 27 30 33 |
| |0 0 0 0 6 12 18 24 30 36 42 |
+-+--------------------------------+
|1|0 6 9 12 15 18 21 24 27 30 33 |
| |0 0 0 6 12 18 24 30 36 42 48 |
+-+--------------------------------+
|2|0 6 9 12 15 18 21 24 27 30 33 |
| |0 0 6 12 18 24 30 36 42 48 54 |
+-+--------------------------------+
|3|0 6 9 12 15 18 21 24 27 30 33 |
| |0 6 12 18 24 30 36 42 48 54 60 |
+-+--------------------------------+
|4|0 6 9 12 15 18 21 24 27 30 33 |
| |6 12 18 24 30 36 42 48 54 60 66 |
+-+--------------------------------+
74 4 Network Calculus
|5| 0 6 9 12 15 18 21 24 27 30 33|
| |12 18 24 30 36 42 48 54 60 66 72|
+-+--------------------------------+
|6| 0 6 9 12 15 18 21 24 27 30 33|
| |18 24 30 36 42 48 54 60 66 72 78|
+-+--------------------------------+
The next stage counts the number of zeros returned by delay, which equals the num-
ber of time intervals for which f10 (s) ≤ g6 (s + τ )
(i.7) +/@:-.@:delay 10
3
Output Bounds
The bound for the output is given by the min-plus deconvolution of the arrival and
service curve where the deconvolution operation is:
Note that the min-plus deconvolution operator is not necessarily zero for t < 0. In J,
we can compute the bound for the output:
Consider a streaming video application. Every T = 4 time units, the sender transmits
a frame of size w = 6. We can model this arrival curve with the stair function
g7 = 6u4,4 . We define the arrival g7 in J as:
g7 =: 6&*@(4 4&stair)
4.6 Streaming Video Example 75
25
●
●
20
●
15
●
output
●
10
●
5
0
● ●
−4 −2 0 2 4
g7 i.11
0 6 6 6 12 12 12 12 18 18 18
The sender and receiver are connected via a CBR link with R = 3. We use the
function f5 = λ3 defined above to represent the service curve of the link.
A function f ∈ F is a “good” function if it satisfies, according to Le Boudec and
Thiran [36], any of the following:
(f5;g7) 0
0 0
1 1 1 1 1 1 1 1 1 1 1
(g7@(t+s) <: g7@t + g7@s) 10
1 1 1 1 1 1 1 1 1 1 1
and g4 = g4∗ :
• f =: f ⋆ f .
The J expression below shows that f1 = f1 ⋆ f1 :
and g3 = g3 ⋆ g3 :
However, g4 = g4 ⊘ g4 :
4.6 Streaming Video Example 77
When the sender outputs w = 6 units of data in a single batch (then it is idle until the
next frame is due). However, the CBR link can only process three units of date per
time interval. Thus, the sender’s traffic flow is constrained by f1 as well as g4 . The
combined arrival curve is f4 = f1 ⊕ g4 , which is given by the J expression:
f4 =: f1 min"0 g4
f4 i.11
0 3 6 6 6 12 12 12 12 18 18
However, f4 does not respresent the tightest bound, as f4 (5) ≤ 6 and f4 (6) ≤ 12,
whereas f4 (6) should be bounded by nine.
We can check the subadditive properties of f4 . The result of the J expression below
shows us that f4 is not subadditive:
Note that $: is the self-reference construct. The resultant subadditive closure f1∗
yields a tighter bound than f4 itself:
g4
● ● ●
15
● ● ● ●
traffic
10
● ● ●
5
0
0 2 4 6 8 10
min(f1,g4)
● ● ●
15
● ● ● ●
traffic
10
● ●
5
●
0
0 2 4 6 8 10
f1 * g4
● ●
15
● ● ●
traffic
10
● ●
5
●
0
0 2 4 6 8 10
Fig. 4.7. Video frame transmission curve u4,4 (top), the pointwise minimum of λ3 and u4,4
(middle) and the convolution of λ3 and u4,4 (bottom)
The effective bandwidth function provides a means of specifying the bit rate require-
ments of a traffic flow for a given delay bound. For a flow A, expressed as a cumula-
tive function, and a delay bound D, the effective bandwidth is given by:
A(t) − A(s)
eD (A) = max (4.39)
0≤s≤t t−s+D
The effective bandwidth for flow A1 can be calculated for various delay bounds:
5.0
time scale: 5
time scale 10
4.5
effective bandwidth
4.0
3.5
3.0
2.5
delay
We can see that, for zero delay, the effective bandwidth is three, which is the mean
rate of A1 over the interval [0, 10]. It diminishes as the tolerable delay bound in-
creases. However, A1 is not constant over t, if we examine the effective bandwidth
over some other time scale (the interval [0, 5] say) the result is different. The effective
bandwidth at this time scale is higher than for the previous example. We can see that
for zero delay tolerance, the effective bandwidth is five, which is equal to the peak
rate of A1 :
4.0
time scale: 5
time scale: 10
3.5
effective bandwidth
3.0
2.5
delay
f (s)
eD (f ) = max (4.40)
s≥0 s+D
For the affine curve f2 = γ3,1 we can compute the effective bandwidth thus:
The graph in Fig 4.9 shows the effective bandwidth for f2 = γ3,1 over the time scales
t = 5 and t = 10.
The equivalent capacity specifies the bit rate for a flow, given some backlog bound.
For a flow A and backlog bound Q, the equivalent capacity is given by the equation
below:
A(t) − A(s) − Q
eQ (A) = max (4.41)
0≤s≤t t−s
We can compute the equivalent capacity for A1 for a time scale of t = 10 with the J
expression:
4.8 Summary 81
Just as with the effective bandwidth, the equivalent capacity is higher for a time scale
t = 5:
f (s) − Q
eQ (f ) = max (4.42)
s≥0 s
Figure 4.9 shows effective bandwidth for f2 for various time scales.
4.8 Summary
Insights into traffic flows can be gained from network calculus. Flows are charac-
terised by envelope curves. Service curves can be expressed in a similar way. Then,
using min-plus algebra, delay bounds can be derived for backlog, delay and output.
Effective bandwidth and equivalent capacity provide a way of determining network
resource requirements for flows with determinsitic QoS bounds (in terms of delay
and backlog, respectively). We revisit the topic of effective bandwidth in Chapter 6
for deriving bounds that are probabilistic.
5
In this chapter we introduce stochastic processes and the statistical methods for
analysing them. Specifically, we focus on processes with long-memory, which have
been subject to much research in relation to data networks [6, 16] and are considered
to be more representative of network traffic (particularly in packet networks) than tra-
ditional Markovian models. We introduce the concept of short-range and long-range
dependence and how these can be simulated in J.
The long-range dependence property is often accompanied by self-similarity.1 We
will refer to short-range dependent and long-range dependent self-similar processes
as “srd” and “lrd-ss,” respectively. Whereas srd traffic processes tend to smooth
rapidly as we “zoom in,” lrd-ss processes retain their burstiness.
In this chapter, we develop a number of functions in J for generating and analysing
both srd and lrd-ss stochastic processes. We also show how srd and lrd-ss properties
can be identified.
Network analysis makes extensive use of simulation techniques and thus relies heav-
ily on random number generators (RNG). In this section, we develop a number of
functions for (pseudo) random number generation.
The monadic roll primitive ? returns a random integer in the range 0 to n − 1, where
n is the value of the argument. So, for example, the line below returns six random
numbers between 0 and 9:
? 10 10 10 10 10 10
4 1 3 3 0 6
1
The correct term for the property found in network traffic is asymptotically, statistically
self-similar.
84 5 Stochastic Processes and Statistical Methods
>:@? 10 # 6
2 4 3 2 2 4 5 5 4 6
The reader should note that the results of examples involving RNG functions, will
(most likely) differ from those in this book. The function rand, defined below, gen-
erates uniformly distributed random numbers in the range 0 to 231 -1:
rand_z_ =: (?@$&2147483646)
The verb is monadic, and its argument specifies how many random numbers to gene-
rate:
rand 5
592937061 1229445466 1065583194 180909904 260315076
rand 3 2
463322583 1277891113
1922703664 1984820816
1393776341 1706683049
runif_z_ =: 2147483647&(%˜)@rand
runif 5
0.120287 0.284969 0.481986 0.188577 0.104365
There are a number of methods for generating Gaussian random variates. Here we
use the convolution method in [52]:
i=n
12 √
ǫ= Ui (0, 1) − 3n (5.1)
n i=1
where Ui (0, 1) is a uniformly distributed random variate in the interval [0, 1). This
generator exploits the central limit theorm, whereby the sum of a sample of n iid
(independent, identically distributed) random variates (not necessarily Gaussian)
converges to a Normal distribution. The larger the number of variates n, the closer
the approximation to normality.2 The function in Listing 5.1 implements a random
number generator for normal random variates of mean zero and variance one:
2
Clearly there is a trade-off between convergence to normality and the processing cost in-
curred in calculating each random variate.
5.1 Random Number Generators 85
rnorm 5
0.683747 0.300376 _0.825842 0.347796 1.09792
See [71] for other implementations of Gaussian random number generators. Expo-
nentially distributed random variates [54] are derived:
rexp_z_ =: (-@ˆ.)@runif
If we wish to generate exponential variates for some arbitrary mean, the RNG is:
A random variable from a geometric distribution is the length of the sequence until
the first state change in a sequence of Bernoulli trials. The probability distribution is
given by:
P (X = x) = p(1 − p)x x = 0, 1, . . . , 0 < p < 1 (5.3)
Geometric random variates are derived:
V
Geo = (5.4)
loge (1 − p)
86 5 Stochastic Processes and Statistical Methods
cocurrent <’RGEO’
p =: lhs1
n =: rhs1
f1 =: rexp@n
f2 =: ˆ.@(1:-p)
f3 =: -@f1%f2
f4 =: <.@>:@f3
cocurrent <’base’
rgeo_z_ =: f4_RGEO_
The expectation of the geometric RNG is the reciprocal of the probability; that is,
1/p. Thus:
hd1 =: ’theoretical’;’simulation’
hd1,: (% 0.4); (+/%#) 0.4 rgeo 10000
+-----------+----------+
|theoretical|simulation|
+-----------+----------+
|2.5 |2.498 |
+-----------+----------+
mpar_z_ =: *%<:@]
1 mpar 1.1 1.2 1.5 1.7 2
11 6 3 2.42857 2
The example below generates a number of random Pareto variates for α = 1.2 and
β = 1, for which the expectation is six. It can be seen that the resultant sample mean
is close:
In Listing 5.4 we redefine some of the basic statistical functions introduced earlier in
Section 3.3.
We can confirm that rnorm returns Gaussian variates with (approximately) zero mean
and a standard deviation of one:
88 5 Stochastic Processes and Statistical Methods
hd2 =: ’mean’;’std’
hd2,: (mean;std) rnorm 10000
+-----------+--------+
|mean |std |
+-----------+--------+
|_0.00818183|0.995637|
+-----------+--------+
Note that most of the functions are enclosed in [: and ]. The right verb ], which
was introduced in Section 2.4, returns the right-hand argument passed to it. The cap
primitive [: is used to force a function to behave monadically, even if it is used
dyadically. In order to illustrate the difference, we compare the execution of sqdev
with its uncapped equivalent, sqdev2:
sqdev2 =: *:@mdev
(sqdev;sqdev2) 1 2 3 4
+-------------------+-------------------+
|2.25 0.25 0.25 2.25|2.25 0.25 0.25 2.25|
+-------------------+-------------------+
2 (sqdev;sqdev2) 1 2 3 4
+-------------------+----+
|2.25 0.25 0.25 2.25|0.25|
+-------------------+----+
For the verb sqdev2, the presence of the left argument has caused - in dev to behave
as a dyad; thus it performs a subtraction instead of a (monadic) negation. The mean
of the right-hand argument is subtracted from the value of the left-hand argument
(in this case, two). That is, the arithmetic operation 2 − x is performed instead of
xi − x. In the case of sqdev, - is unaffected by the left-hand argument and performs
a monadic negation function due to the [: ] encapsulation. This may not seem
important, as running a monadic verb as a dyad makes little sense. However, these
verbs may be used to build other functions which are designed to operate as dyads.
The presence of a left-hand argument will cause any monadic subfunctions to behave
dyadically, resulting in an undesirable change in their intended functionality. In this
example, the - primtive behaves as a subtraction instead of a negation.
The covariance COVXY and correlation CORXY of the two random variables X and
Y are given by:
5.2 Statistical Functions 89
i=n
1
COVXY = (Xi − X)(Yi − Y ) (5.8)
n − 1 i=1
COVXY
CORXY = (5.9)
sX sY
The implementation of the covariance and correlation functions cov and cor, are
shown below:
sp_z_ =: [: +/ *&mdev
cov_z_ =: sp % dof
cor_z_ =: cov % (*&std)
The command-lines below compute the covariance and correlation of the two sets of
(uniformly distributed) random numbers:
X =: rnorm 100
Y =: rnorm 100
hd3 =: ’covariance’;’correlation’
hd3,: Y (cov;cor) X
+----------+-----------+
|covariance|correlation|
+----------+-----------+
|_0.0180343|_0.0166897 |
+----------+-----------+
As expected, the covarianace and correlation are low. The autocovariance c(k) and
autocorrelation coefficient r(k) are defined below:
t=n
1
c(k) = (Xt − X)(Xt−k − X) (5.10)
n
t=k+1
t=n
t=k+1 (Xt − X)(Xt−k − X)
r(k) = t=n (5.11)
t=k+1 (Xt − X)
where k is the lag. The corresponding J verbs for c(k) and r(k) are autocov and
autocor, respectively. These verbs are defined in Listing 5.5.
The autocovariance is the sum of the products (sp) of the deviations, divided by
the length of the times series. The autocorrelation is the sum of the products of the
deviations, divided by the sum of the squares. For example, the autocovariance and
autocorrelation for 10,000 normal deviates at lag k = 1, can be computed:
We can apply these functions over a range of lags. Using autocor to illustrate, we
define k as a column list:
The graph in Fig 5.1 shows the autocorrelation coefficients for an iid random variable
with k = 0, 1, . . . , 100. It can be seen that, for lags k > 0, the autocorrelations are
small, which means that serial correlations are negligible. This is what we would
expect for an iid random variable.
A variance time plot shows the rate at which the variance of a time series decays
over different time scales. The aggregated process X (m) is the averaged values of X
grouped into non-overlapping blocks of m; that is:
km
X (m) (k) = 1/m X(i) k = 1, 2, . . . (5.12)
i=(k−1)m+1
The J function below calculates var[X (m) ], taking the block size m as the left-hand
argument and X(t) as the right-hand argument:
5.2 Statistical Functions 91
1.0
0.8
0.6
r(x)
0.4
0.2
0.0
0 20 40 60 80 100
lag
The central limit theorm states that the variance of the sample mean decays as the
reciprocal of the sample size m; that is:
For the purpose of illustration we generate 10,000 Gaussian random variates and find
the variance-time plot:
X =: rnorm 10000
m =: col 10 to 100
vx =: m varm"1 X
We take logs of both sides and calculate the least squares linear regression coeffi-
cients using the matrix divide verb %., thus:
hd5 =: ’intercept’;’slope’
hd5,: ;/ (log10 vx) %. 1,.log10 m
+----------+--------+
|intercept |slope |
+----------+--------+
|0.00887776|_1.02227|
+----------+--------+
The slope is approximately −1, which is what we would expect for an iid random
variable. Figure 5.2 shows the variance time plot on a log-log scale.
Analysis in the frequency domain also provides valuable insights into the nature of
the time series. The discrete fourier transform is given by:
j=n−1
H(k) = h(j)e−2πijk/n k = 0, . . . , n − 1 (5.16)
j=0
5.2 Statistical Functions 93
The discrete fourier transform is shown in Listing 5.6. Recall that eu is Euler’s for-
mula eiθ = cosθ + isinθ:
sqw =: 1 1 1 1 _1 _1 _1 _1
freq =: col i.8
Calculate the transform of the square wave, returning the result in amplitude and
phase form:
A useful analysis tool for time series is the power spectrum. The power spectrum
derived from the fourier transform of the autocorrelation coefficients:
j=n−1
Sh (k) = rh (j + 1)e−2πijk/n (5.17)
j=0
Thus, for an iid random variable (with a Gaussian distribtution), the power spectrum
can be computed:
94 5 Stochastic Processes and Statistical Methods
X =: rnorm 10000
ax =: (col 1 to 100) autocor"1 X
sx =: (col 1 to 100) dft"1 ax
The graph in Fig 5.3 shows the power spectrum for the time series X. It can be seen
that the power spectrum is (nearly) flat across the frequency range. This is what we
would expect and is indicative of white noise. We can confirm this by taking logs
and calculating the slope of the graph:
p
−1.0
●
●
●
●
●
−1.2
●
●
●
●●
●
●●●
−1.4
●
log10 variance
●
●●
●
●●
●●●● ● ●
−1.6
●
●●
●● ●
●●●
●●
● ●● ●
●
−1.8
●● ●● ●
● ●●
●● ●●
●●
●●● ●
● ● ●●
● ●
● ●
●●●
● ●●●
●
−2.0
● ●
●●●●●
●
●●●
●
●
●
log10 m
−3.0
−3.5
log10 spectral density
−4.0
−4.5
log10 frequency
Thus, a white noise process, centered around the value of two, can be generated by:
2 + rnorm 5
2.92504 1.9345 _0.5072 2.48281 3.52364
Autoregressive (AR) and moving average are two types of process that exhibit
short-range dependence; that is, their autocorrelation coefficients decay exponen-
tially quickly with increased lag:
Only the state of the system in the near past has any significant influence on the
current state. An autogressive process of order p, denoted by AR(p), is given by the
expression:
i=p
X(t) = φi X(t − i) + ǫ(t) (5.20)
i=1
where B is the backshift operator, such that B i = X(t − i). ARMA processes
are special cases of the more generalised autoregressive integrated moving mverage
(ARIMA) processes. The ARIMA(p, d, q) process is an integrated AR(p) and MA(q)
process with a differencing parameter d:
i=p
i=q
1− φi B i (1 − B)d Xt = 1 + θi B i ǫt (5.24)
i=1 i=1
ARIMA and ARMA are equivalent when d = 0. If 0 < d < 1, then the process is
a fractional ARIMA process and exhibit properties of long-range dependence and
statistcial self-similarity (lrd-ss). The J functions autocor, varm and dft, developed in
Section 5.2, enable us to analyse time series and determine the presence of lrd-ss.
We must include 1 as the first coefficient. We stitch the random numbers and the
coefficients together to form a matrix to be passed to ar:
]Y =: x ,: (|.phi)
8.4 5.5 7.1 _15.2 14.1 3.8 _10.4 _21.7 _3.6 _7.4
0.1 0.2 0.4 1 0 0 0 0 0 0
A desirable effect of the stitch operation is that the coefficients are padded with zeros,
up to the length of x. When we calculate X(0), we not only need a corresponding
ǫ(0), but also {X(−1), . . . , X(−p)}. As we do not have these terms, we simply
substitute {ǫ(−1), . . . , ǫ(−p)} instead. We, therefore, use the first p values of x.
Also, x represents ǫ(t) for t = {0 − p, 1 − p, . . . , n − p}. The functions below extract
the time series ǫ(t) and the coefficients:
cocurrent <’AR’
et =: rhs1
coefs =: rhs2
The autoregressive term X(t) is just the inner product of the coefficients and (past)
time series. Thus X(0) can be calculated:
g1 =: coefs ip et
g1 Y_base_
9.96
The term ǫ(t) is substituted for X(t); that is, we replace the corresponding value in x
for the newly computed autoregressive term. In order to do this, we need to calculate
the index t which is the current time in the series. The functions below compute two
masks, one that represents the past and present values (of x) and one that is for future
values:
f1 =: *@ coefs
f2 =: |.@f1
f3 =: +/\@f2
mask1 =: |.@(*@f3)
mask2 =: not@mask1
98 5 Stochastic Processes and Statistical Methods
(mask1,:mask2) Y_base_
1 1 1 1 0 0 0 0 0 0
0 0 0 0 1 1 1 1 1 1
The first four elements of X represent the past and present values of the AR process;
that is X(t), X(t − 1), . . ., while the last six elements represent ǫ(t + 1), ǫ(t + 2)
etc. The J verb below implements the AR process:
f5 =: <:@(+/@mask1)
f6 =: +/@mask2
f7 =: f5 {. et NB. -p to (i-1) elements
f8 =: (-@f6) {. et NB.(i+1) to n elements
xnext =: f7,g1,f8 NB. insert u(i)
cocurrent < ’base’
ar_z_ =: xnext_AR_,:cnext_AR_
This example demonstrates the evolution of the function for the first four iterations:
arˆ:(i.4) Y
8.4 5.5 _15.2 14.1 3.8 _10.4 _3.6 _7.4
0.1 0.2 0.4 1 0 0 0 0
The coefficients “move” forward after each iteration. Successive values of ǫt are re-
placed with their corresponding autoregressive terms X(t). Running the function for
eight iterations, removing the coefficients and stripping off the history terms gives:
2 4 $ _8 {. rhs1(arˆ:(8) X)
8.4 5.5 _15.2 9.96
5.294 _7.8104 _4.66936 _0.163395
6
●
3 MA
5 MA
●
5
●
●
●
● ●
3
●
● ●
●
●
● ●
2
●
● ● ●
●
● ● ●
●
● ●
●
● ● ●
1
● ● ●● ● ● ●
● ● ● ●
● ●● ● ●
●● ● ●● ● ● ●● ●
●
●● ● ● ● ● ● ● ● ●●
●● ● ● ● ● ●
● ● ● ●●
● ● ●● ● ● ●● ● ●
● ●● ●
● ● ● ●● ●
0
0 20 40 60 80 100
A simple moving average function for the basic smoothing of time series data is fairly
straightforward to implement in J:
sma_z_ =: +/\%[
Generate seven exponentially distributed random variates and smooth them with a
3 MA process:
]X =: rexp 6
2.80561 1.5806 0.973211 2.19895 0.870357 0.0316778
3 sma X
1.78647 1.58425 1.34751 1.03366
With the simple MA, each value of X has equal weight, in this case 1/3:
Xi−1 + Xi + Xi+1
X (3 MA) (i) =: (5.25)
3
100 5 Stochastic Processes and Statistical Methods
The graph in Fig 5.4 shows the 3 MA and 5 MA for time series of exponential distrib-
uted random variables. Weighted moving averages in Equation (5.21) is implemented
in Listing 5.7.
A moving average of order three, MA(3) with θ1 = θ2 = θ3 = 1/3 yields the same
result as the simple 3 MA:
Note the different use of terminology. For a simple smoothing MA, we use q MA,
where q is order. However, for a weighted MA of order q, we use MA(q).
Time series with long-memory can be generated using an ARIMA process with a
fractional differencing parameter 0 < d < 1/2. This special case of an ARIMA
process is called a fractional ARIMA process or FARIMA(p, d, q). Furthermore,
properties of long-memory do not require an AR or MA component; that is, a
FARIMA(0, d, 0) process is sufficient to produce long-memory. Thus, we can sim-
plify Equation (5.23):
X(t)(1 − B)d = ǫ(t) (5.26)
d =: 0.3 [ k =: i.5
k ! d
1 0.3 _0.105 0.0595 _0.0401625
5.3 Stochastic Processes 101
However, what we actually need to find are the coefficients for the expansion of
(1 − B)−d , as we are ultimately computing X(t), where:
ǫ(t)
X(t) =
(1 − B)d
d
The J expression below yields the sequence of terms k (−1)k :
(_1 ˆ k) * k ! -d
1 0.3 0.195 0.1495 0.123337
The verb fdcoefs in Listing 5.8 computes the terms of the expansion for d and k. The
fractional differencing function fdiff is shown in Listing 5.9.
We show how the fractional differencing function works with the power conjunction.
First we compute (the first five) coefficients for (1 − B)−d :
cf =: 0.3 fdcoefs 5
As fdiff returns e(t) and X(t) in boxed format, the term >rhs2 extracts X(t) and
unboxes it (again the term 4 4 $ is merely for brevity).
The wrapper function in Listing 5.10 simplifies the execution of fdiff. The explicit
function fd takes the fractional differencing paramter d as the left-hand argument and
the number of coefficients and the length of the time series as the right agruments.
We generate a FARIMA(0, d, 0) time series and analyse it with the statistical tools
developed earlier in this chapter. Processes with long-range dependence and self-
similarity are characterised by the Hurst parameter 0.5 ≤ H ≤ 1, where H →
1 indicates a high degree of long-range dependence and self-similarity. H → 0.5
indicates short-range dependence (autocorrelations that decay exponentially) or even
independence. We show how H can be estimated from both the time (variance time
plot) and frequency (power spectrum) domain.
The relationship between the Hurst parameter and fractional differencing parameter
is H = 1/2+d, so setting d = 0.3 should result in H = 0.8. We generate a sequence
of 10,000 values of a FARIMA(0, 0.3, 0) process with the command:
There is little point in using more than 170 coefficients as the reciprocal of 171
factorial is very small; so small, for the level of precision in J, it is zero:
m =: col 10 to 100
vy =: m varm"1 y
Take logs of var[X (m) ] and m and find the slope β using linear regression:
H = 1 − β/2 (5.30)
hurst_z_ =: >:@-@-:
hurst 0.431246
0.773587
k =: col 1 to 200
freq =: col 1 to 100
ry =: k autocor"1 y NB. autocorrelation
gamma =: freq dft"1 ry NB. power spectrum
hurst2 =: -:@>:
hurst2 0.65241
0.826205
The graphs in Fig 5.5 show the time series plot for a FARIMA(0,0.3,0) process (top
left), autocorrelation function (top right), power spectrum (bottom left) and variance
time plot (bottom right).
We define network flow Yi = {Yi (t), t = 0, 1, . . .} that, in any time interval t, either
transmits at a rate of one, or is silent. If X(t) is an FARIMA(0, d, 0) process, then:
0 if X(t) < 0
Yi (t) = (5.33)
1 if X(t) ≥ 0
As X(t) is centered around the origin (zero mean), the average transmission rate
of Yi (t) is 1/2. The J script in Listing 5.11 is a traffic simulation for long-range
dependent flows. It generates a number of (FARIMA) flows (using the fractional
differencing verb fd) and returns the aggregate.
5.4 Queue Analysis 105
0.4
3
2
0.3
1
r(x)
x(t)
0.2
0
0.1
−2
t lag
0.0 ●●●●●●
log10 spectrum
log10 variance
●●●●●●●●
●●●●●●●●●
●●●
●●
●●
●●
●●
●●
●●
−2.5
●
●●
●●
●
●●
●●
●
●●
●●
●●●●
●
●
●●●
●●
●●●
●
●●
●●
●●
●
●●
●●
●●●
●●
●
●●
−1.0
slope = −1
−3.5
−2.0
0.0 0.5 1.0 1.5 2.0 1.0 1.2 1.4 1.6 1.8 2.0
Fig. 5.5. Time series for an FARIMA(0,0.3,0) process (top left), autocorrelation function (top
right), power spectrum (bottom left) and variance time plot (bottom right)
Thus, we generate an aggregate traffic flow of 20 flows, over a period of 2000 time
intervals with a fractional differencing parameter d = 0.45, using the command:
y1=:0.45 ts 20 2000
We can use the variance time plot to determine the amount of lrd-ss in the aggregate
process.
vy1 =: m varm"1 y1
hd5,: ;/ (log10 vy1) %. 1,.log10 m
+---------+---------+
|intercept|slope |
+---------+---------+
|0.809115 |_0.476281|
+---------+---------+
hurst 0.476281
0.76186
The Hurst parameter yields a somewhat lower value than expected. Using a fractional
differencing parameter d = 0.45, we would expect a value of H closer to 0.95. How-
ever, multiplexing is known to reduce burstiness [10]. Moreover, this is a somewhat
crude method of generating lrd-ss network traffic. More effective methods will be
discussed later.
As this aggregate flow of traffic arrives at the buffer queue of a work conserving
communications link, the size of the queue q(t) at time t is given by the Lindley
equation [39]. We can, therefore, analyse the queue with:
In order to gain an insight into the effects that lrd-ss traffic have on the backlog, we
need to compare it against a traffic flow derived from a Markovian model (such as a
Poisson process). However there is a simpler (and possibly more effective) method
of comparing lrd-ss with srd traffic. If we take our original lrd-ss time series y1 , and
randomly sort it, then the serial correlations in the sequence will be removed. The J
function below randomly sorts a list of values:
rsort_z_ =: {˜ ?˜@#
y2 =: rsort y1
We can check that the variances of a new time series decays as the reciprocol of m
to confirm that we have removed the long-range dependence and self-similarity:
|intercept|slope |
+---------+--------+
|0.63591 |_1.04039|
+---------+--------+
The slope of the decay on a log-log plot is close to -1, so the sequence is short-range
dependent (srd). However, note that y1 and y2 contain the same volume of data:
+/ y1,.y2
19786 19786
Consequently, they also have the same mean and peak rate:
hd6 =: ’’;’y1’;’y2’
hd7 =: ’mean’;’max’
hd6, hd7,. 2 2 $ ;/ (mean, max) y1,.y2
+----+------+------+
| |y1 |y2 |
+----+------+------+
|mean|9.8905|9.8905|
+----+------+------+
|max |18 |18 |
+----+------+------+
The sequences y1 and y2 differ by virtue of the reordering of y2 . Analyse the queue
for the srd (randomly sorted) traffic arrival process:
q2 =: (12;y2) lindleyˆ:(2000) 0
It can be seen that the mean and peak queue size of the two arrival processes is
significantly different:
Clearly, if we had assumed that the arrival process was Markovian, when it was
actually lrd-ss, we would have underestimated the required buffer queue (setting it
to 7 rather than 31). This would have resulted in a significantly greater number of
dropped packets than expected. The graph in Fig 5.6 clearly shows the difference in
the backlog of y1 and y2 . From a capacity planning point of view, the lrd-ss traffic
arrival process needs a faster link to keep the backlog low:
108 5 Stochastic Processes and Statistical Methods
lrd−ss
25
queue size
15
0 5
srd
25
queue size
15
0 5
q3 =: (14;y1) lindleyˆ:(2000) 0
hd7,: (mean;max) q3
+--------+---+
|mean |max|
+--------+---+
|0.045977|6 |
+--------+---+
5.5 Summary
The focus of this chapter was stochastic processes relevant to modeling network
traffic and the statistical methods for analysing them. We introduced the concepts of
short-range dependence and long-range dependence/self-similarity. We developed J
functions for generating time series based upon AR and MA models. These resulted
in srd time series. Time series with lrd-ss properies were generated using fractional
differencing methods (FARIMA), whereby the degree of lrd-ss is determined by the
fractional differencing parameter d.
6
Network traffic is often modelled as Markov processes. The problem with these mod-
els is that they do not necessarily capture the statistical properties of actual network
traffic. It has been widely reported that network traffic exhibits fractal properties
[6, 13, 37], that is, they have nonsummable autocorrelations, slowly decaying vari-
ances, spectral densities that obey a power law near the origin, and heavy-tailed
distributions.
In this chapter, we introduce discrete on/off models for simulating traffic sources.
Short-range dependent (srd), and thus Markovian, traffic models can be generated
by sampling on and off periods from geometric distributions. Traffic with long-range
dependence and self-similar (lrd-ss) properties can be generated by replacing the
geometric distribution with a heavy-tailed distribution (such as the Pareto distrib-
ution). J functions are developed for simulating srd traffic with Geo[on]-Geo[off]
times and lrd-ss traffic with Geo[on]-Par[off] times. We use the functions developed
in Chapter 5 to analyse the simulated traffic in this chapter.
Chapter 4 introduced the concept of effective bandwidth, as a means of calculating
resource requirements for flows that expect deterministic delay bounds. Effective
bandwidth measures were derived, either from an arrival sequence or an arrival curve.
In this chapter we revisit effective bandwidth and show how resource requirements
can be derived for probabilistic QoS bounds.
A common network traffic model is the on/off model. During the on periods a source
transmits at some (constant) peak rate rpeak and is idle during the off periods. Thus,
the transmission rate of the on/off source r(t) at any time t is:
rpeak on period
r(t) = (6.1)
0 off period
110 6 Traffic Modeling and Simulation
where r is the mean rate. Consequently, the probability of an off period is poff =
1 − pon . A random sequence of binary outcomes S = {Si , i = 1, 2} is a sequence
of Bernoulli trials. For each state Si , there is an associated probability pi = P (X =
Si ), and that the probabilities must sum to one. Thus p1 = 1 − p2 . The J verb below
generates a sequence of Bernoulli trials for S1 = 0 and S2 = 1: .
The right argument specifies the number of trials and the left argument is the prob-
ability p1 . An on/off flow with a peak rate rpeak = 1 and mean rate r = 0.25 has a
“on” probability of pon = p1 = 0.25. The J expression below generates a sequence
of 20 Bernoulli trials, representing the on/off periods of a traffic flow:
0.25 rber 20
0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0
0.3 rber 3 20
1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1
1 0 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1
0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0
As we can see, the mean aggregate rate is close to the expected rate np = 5. The
J verb Listing 6.1 calculates the Binomial distribution function given in Equation
(6.3). The function bindist requires the positional parameter functions, therefore we
use the load command to run the libs.ijs script:
The J expression below computes the binomial distribution for p = 0.25 and n = 20:
5 4 $ 0.25 bindist 20
0.00317121 0.0211414 0.0669478 0.133896
0.189685 0.202331 0.168609 0.112406
0.0608867 0.0270608 0.00992228 0.00300675
0.000751688 0.000154192 2.56987e_5 3.4265e_6
3.56927e_7 2.79942e_8 1.55524e_9 5.45697e_11
The shape term 5 4 $ is merely used for brevity. We can calculate the probability
distribution of a flow. The verb fdist computes the frequency of occurrence of each
member of a data set:
fdist_z_ =: [: +/"1 =/
We calculate the frequencies of each element in a1 and divide them by the tally [:#]
to obtain the probabilities:
5 4 $ (i.20) (fdist%[:#]) a1
0.0027 0.023 0.0674 0.1292
0.1842 0.2078 0.1691 0.1084
0.0645 0.0293 0.0093 0.0039
0.0008 0.0001 0.0003 0
0 0 0 0
112 6 Traffic Modeling and Simulation
The Poisson distribution [26] is a limiting form of the Binomial distribution and is
often used to model packet arrivals and packets being processed. The probability
distribution is given by:
e−λ
P (X = x) = λx (6.4)
x!
Listing 6.2 shows the J verb for computing the Poisson distribution.
5 4 $ 4 poisdist i.20
0.0183156 0.0732626 0.146525 0.195367
0.195367 0.156293 0.104196 0.0595404
0.0297702 0.0132312 0.00529248 0.00192454
0.000641512 0.000197388 5.63967e_5 1.50391e_5
3.75978e_6 8.84654e_7 1.9659e_7 4.13873e_8
The graph in Fig 6.1 shows the Binomial and Poisson distributions. It also shows the
normalised frequency distribution of the arrival process a1 . It can be seen that the
three distributions curves are reasonably alike.
An on/off source can be modeled as a discrete-time Markov chain (see Fig 6.2). The
probability pij = P (j|i) is the probability that the system transitions from state i
to state j. If we assign state 1 to the on period and state 0 to the off period, then T
represents the state probability matrix:
p00 p01 1−a a
T= = (6.5)
p10 p11 b 1−b
6.3 Markov Models 113
0.20
Aggregate flow
Binomial
Poisson
0.15
P(X=x)
0.10
0.05
0.00
0 5 10 15 20
Fig. 6.1. Probability distribution of the aggregate of 20 on/off flows compared to Binomial
and Poisson distribution
Note that the transition probabilities with the same originating state must sum to one;
(k)
that is, p00 + p01 = 1. The probability of the system being in state i at time k is πi .
Thus:
π = πT (6.6)
(k) (k)
where limk→∞ π = π (k) . The terms π0 and π1 are given by the expressions:
For the purpose of illustration, set the values of the transition matrix T to:
0.8 0.2
T= (6.9)
0.6 0.4
Substituting the values of pij , i, j = 1, 2 into the expressions in Equation (6.8) results
in π0 = 0.75 and π1 = 0.25. Assign values to the probability matrix T:
mm_z_ =: +/@:*
(0) (0)
Choose (arbitrary) initial values for π (0) , ensuring that π0 + π1 = 1, then use the
matrix multiply verb and the power conjunction to find π (n) :
By the ninth iteration, the result converges to π0 and π1 . The expectation is given by:
6.4 Effective Bandwidth 115
1
E[X] = i=0 S i πi (6.10)
For a link with capacity c = 5 and arrivals a1 , we can use the Lindley equation to
compute the backlog for an infinite buffer:
The graph in Fig 6.3 shows how the queue evolves over time. It shows that setting
the capacity close to the mean rate of the aggregate flow results in high levels of
backlog. The link is operating at the very limit of its capacity, and the autocorrela-
tions in Fig 6.4 diminish linearly, indicating that the backlog is nonstationary. The
autocorrelations are computed using:
m =: col i.100
rq =: m autocor"1 q1
150
100
queue size
50
0
time
ncac ≤ c/r. The aim is to admit as many connections as possible without exceeding
the QoS bounds. For a delay bound D, we define some QoS parameter γ, such that
the delay exceeds D, with probability e−γ . The shape parameter θ is given by:
γ
θ= (6.11)
D·c
The random variable Xj is the load admitted to the link by flow j in some unit time
interval. The effective bandwidth Λ(θ) is given by:
The effective bandwidth function for deriving probabilistic delay bounds is given in
Listing 6.3.
cocurrent <’EB’
s =: rhs0
6.4 Effective Bandwidth 117
1.00
0.99
0.98
autocorrelation
0.97
0.96
0.95
0.94
0 10 20 30 40
lag
x =: >@lhs1
p =: >@lhs2
f1 =: ˆ@(s */ x)
f2 =: f1 (*"1) p
f3 =: +/"1 @f2
f4 =: (ˆ.@f3) % s
cocurrent <’base’
eb_z_ =: f4_EB_
Generate a Poisson random variable with a mean of two and peak of five:
For a link with capacity c = 5 and a delay bound D = 0.25, the effective bandwidth
over a range of values of θ = γ/Dc is given by the J expression:
rv eb (1 5 10 20)%0.25*5
118 6 Traffic Modeling and Simulation
4.0
3.5
effective bandwidth
3.0
D = 0.25
D = 0.3
D=0.35
D=0.4
2.5
2.0
0 5 10 15 20 25 30
gamma
The graph in Fig 6.5 shows the effective bandwidth for the Poisson process for vari-
ous delay bounds.
Here, we demonstrate how to use effective bandwidth for capacity planning. Suppose
that we have a link of capacity c = 5 and we wish to determine the maximum
number of flows that can be admitted to the link for a given QoS. For the purpose of
illustration, we specify a delay bound D = 0.4. For γ = 2, the probablity that the
delay does not exceed 0.4 with a probability greater than 1 − e−2 . The computation
in J is:
(>:@-@ˆ) _2
0.864665
In other words, the link should satisfy the delay bound approximately 86 percent of
time, provided the flows honour their traffic contract. For the purpose of illustration,
we set the mean rate of the flow to r = 0.25 and the peak rate rpeak = 1. In the
example above (Section 6.2), we saw the effects of running 20 such flows (over a
link of capacity c = 5). The delay is the service time (1/c) plus the the time spent
6.4 Effective Bandwidth 119
waiting in the queue. We can calculate the percentage of time for which the delay
bound is exceeded:
delay =: 0.2 * q1 + 1
mean 0.4 <: delay
0.986302
The QoS is maintained less than 2 percent of the time if we provision the link for the
mean rate of the aggregate flow. If we provision the link for the peak rate, then only
five flows can be admitted and each will receive a delay of 0.2, which is well within
our delay bound D = 0.4. If, however, we capacity plan for the effective bandwidth
Λ(θ), then we should be able to admit more flows to the link and still maintain the
required QoS. Given that s = γ/Dc, the effective bandwidth of a flow is:
Dividing the link capacity c by the effective bandwidth Λ(θ) gives the number of
flows:
ceil 5 % 0.357374
13
The link should provide QoS for up to 13 flows. Generate 13 on/off flows and aggre-
gate them:
q2 =: (5;a2) lindleyˆ:(10000) 0
hd1,: (mean;max) q2
+--------+---+
|mean |max|
+--------+---+
|0.162784|6 |
+--------+---+
Then, we calculate the proportion of times the delay bound (D = 0.4) is exceeded:
delay2 =: (1+q2)%5
mean delay2 ge 0.4
0.10289
The delay is within the required bound approximately 90 percent of the time, thus
QoS is maintained. Let us repeat this experiment for 14 flows:
120 6 Traffic Modeling and Simulation
Recall that e−2 ≈ 0.135; thus the link cannot quite maintain the desired quality of
service with 14 flows.
In this section, we develop J verbs for generating simulations of traffic flows based
upon on/off models. The superposition of flows with heavy-tailed on or off periods
(or on and off periods) results in long-range dependence and self-similarity (lrd-ss)
[55]. Two models are implemented, one with geometrically distributed on and off
times, and one with Pareto distributed on times and geometrically distributed off
times. The former model, Geo[on]-Geo[off], produces a Markovian traffic flow. The
latter model Geo[on]-Par[off], when multiple flows are aggregated, produces a traffic
process that is lrd-ss. The verb definition in Listing 6.4 generates Geo[on]/Geo[off]
traffic flows.
The verb oosrd takes two left arguments, which are the respective on and off transi-
tion probabilities. The expression below generates 20 Geo[on]-Geo[off] flows:
a4 =: (1001 to 3000) { +/ x4
We then find the mean rate, peak rate and standard deviation of the aggregate flow:
6.5 Discrete On/Off Source Models 121
hd2 =: hd1,<’std’
(mean; max; std) a4
+------+---+-------+
|mean |max|std |
+------+---+-------+
|5.0645|12 |1.94582|
+------+---+-------+
The resultant flow should be short-range dependent (srd). Use the variance-time plot
to confirm this:
m =: col 10 to 100
vx4 =: m varm"1 a4
We determine the slope at which the variance diminishes (with m) on the log-log
scale:
hd3 =: ’intercept’;’slope’
hd3,: ;/ (log10 vx4) %. (1,.log10 m)
+---------+--------+
|intercept|slope |
+---------+--------+
|0.874321 |_1.00042|
+---------+--------+
hurst 1.00042
0.49979
In Listing 6.5, we define the verb for generating traffic flows with geometrically
distributed on periods and Pareto distributed off periods.
122 6 Traffic Modeling and Simulation
From the variance-time plot, we can see that the traffic process with heavy-tailed off
times yields a value of H ≈ 0.93, which indicates a high degree of lrd-ss:
vx5 =: m varm"1 a5
hd3,: ;/(log10 vx5) %. 1,.log10 m
+---------+---------+
|intercept|slope |
+---------+---------+
|0.55286 |_0.143089|
+---------+---------+
hurst 0.143089
0.928455
We can compare the queue dynamics of the two traffic sources by calculating the
backlog. We assume that the queue is sufficiently large so that there are no packet
drops. We use the Lindley equation thus:
q4 =: (8;a4) lindleyˆ:(2000) 0
q5 =: (8;a5) lindleyˆ:(2000) 0
It can be seen that the backlog for the lrd-ss traffic source is far larger (and more
varied) than for srd traffic:
6.5 Discrete On/Off Source Models 123
srd lrd−ss
10
20
queue size (segments)
15
6
10
4
5
2
0
0
0 500 1000 1500 2000 0 500 1000 1500 2000
t t
20
20
15
15
q4(t)
q5(t)
10
10
5
5
0
0 5 10 15 20 0 5 10 15 20
q4(t+1) q5(t+1)
Fig. 6.6. The queue dynamics of a srd and lrd-ss traffic processes
hd4 =: ’q4’;’q5’
hd2, (hd4,. (mean; max ; std)"1 q4,:q5)
+--+--------+---+--------+
| |mean |max|std |
+--+--------+---+--------+
|q4|0.132434|11 |0.694948|
+--+--------+---+--------+
|q5|0.681659|22 |2.38015 |
+--+--------+---+--------+
The graphs in Fig 6.6 (top) show the backlog for the srd (q4 ) and lrd-ss (q5 ) traffic
processes respectively. Figure 6.6 also shows the backlog as two dimensional phase
diagrams by plotting q4 (t) against q4 (t + 1) (bottom left) and q5 (t) against q5 (t + 1)
(bottom right). The J verb below, when supplied with a list of values y, returns two
lists y(t) and y(t + 1):
The phase diagrams in Fig 6.6 were generated from the expressions:
phase4 =: phasediag q4
phase5 =: phasediag q5
6.6 Summary
On/off models can be used to simulate network traffic. They are based upon the
abstraction that during an on period a source transmits at some constant rate and
is idle during its off period. The superposition of multiple on/off flows with heavy-
tailed on and/or off periods produces lrd-ss traffic.
7
Chaotic Maps
For values of x in the interval [0, 1], the map is an inverted parabola with a maxima at
x = 0.5. The expression in Equation (7.1) can be implemented by the J verb below:
f =: 4&*@(* >:@-)
126 7 Chaotic Maps
load ’libs.ijs’
]x =: int01 i.11
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
f x
0 0.36 0.64 0.84 0.96 1 0.96 0.84 0.64 0.36 0
For the purpose of illustration, we select an initial starting value of x(0) = 0.1 and
iterate the map by applying the power conjunction ˆ: to the function f :
10 5 $ fˆ:(i.50) 0.1
0.1 0.36 0.9216 0.289014 0.821939
0.585421 0.970813 0.113339 0.401974 0.961563
0.147837 0.503924 0.999938 0.000246305 0.000984976
0.00393603 0.0156821 0.0617448 0.23173 0.712124
0.820014 0.590364 0.967337 0.126384 0.441645
0.986379 0.053742 0.203415 0.64815 0.912207
0.320342 0.870893 0.449754 0.989902 0.039986
0.153548 0.519885 0.998418 0.00631654 0.0251066
0.0979049 0.353278 0.913891 0.314778 0.862771
0.473588 0.99721 0.0111304 0.0440261 0.168351
The shape term 10 5 $ is used for brevity. Following the sequence x(n) from the
top left to bottom right reveals no obvious pattern. This is illustrated in graphic form
in Fig 7.1, which shows the trajectory of the map. The graph in Fig 7.2 shows the
plot of successive points; that is, x(n + 1) against x(n). It shows how the points
are attracted to the parabola. The expresssion below is a more generalised form of
Equation (7.1):
g(x) = 4ax(1 − x) (7.3)
The expression in Equation (7.3) describes a family of parabolic curves, where the
magnitude of the maxima is determined by 0 ≤ a ≤ 1 and is implemented in J:
g =: lhs1 * [: f ]
The parameter a is passed as the left argument, where, for the purpose of this exam-
ple, a = 0.8:
0.8 g x
0 0.288 0.512 0.672 0.768 0.8 0.768 0.672 0.512 0.288 0
7.1 Analysing Chaotic Behaviour 127
1.0
0.8
0.6
x(n)
0.4
0.2
0.0
0 10 20 30 40 50
The graph in Fig 7.3 shows the parabolic curves for various values of a. Note that
g(x) = f (x), when a = 1:
hd1 =: ’g’,:’f’
hd1; 1 (g ,: [: f ]) x
+-+---------------------------------------------+
|g|0 0.36 0.64 0.84 0.96 1 0.96 0.84 0.64 0.36 0|
|f|0 0.36 0.64 0.84 0.96 1 0.96 0.84 0.64 0.36 0|
+-+---------------------------------------------+
The value of parameter a does more that affect the height of the parabola; it also de-
termines the behaviour of the trajectories when the map is applied iteratively. Suces-
sive iterations of the map for a = 0.4 shows that the trajectory increases from its
initial starting value x(0) = 0.1 to a stable state:
1.0
0.8
0.6
x(n+1)
0.4
0.2
0.0
x(n)
Fig. 7.2. Plot of x(n + 1) against x(n) for the logistic map in Equation (7.2)
Similarly, a stable state is achieved for a = 0.8, although the (stable) trajectory
cycles between two values:
a=1.0
1.0
a=0.8
0.8
g(x) = 4ax(1−x)
a=0.6
0.6
a=0.4
0.4
a=0.2
0.2
0.0
Fig. 7.3. Parabolic curves for the logistic map in Equation (7.3) for various values of a
The graph in Fig 7.3 shows that the trajectories for a = 0.4, 0.7, 0.8 and 0.88 con-
verge to periodic stable states. For a = 0.4 and 0.7, the trajectories are period one,
and for a = 0.8 and a = 0.88 the periods are 2 and 4, respectively. However, as we
have already seen in Fig 7.1, when a = 1, the trajectory does not converge to any
stable (periodic) state. This behaviour is common in dynamical systems, whereby the
stable state undergoes a series of bifurcations in response to a change in conditions
(in this case, the value of a). As the conditions continue to change, the system lapses
into chaos.
Chaotic systems are sensitive to initial conditions (SIC). This is known as the but-
terfly effect [52], whereby small perturbations in the initial conditions can lead to
widely varying results in the long term. In order to examine this, consider the trajec-
tory for a = 0.8. The J expression below returns the results for the 49th and 50th
iteration of the logistic map for x(0) = 0.1, 0.4 and 0.7:
130 7 Chaotic Maps
a=0.4 a=0.7
1.0
1.0
0.8
0.8
0.6
0.6
x(n)
0.4
0.4
0.2
0.2
0.0
0.0
0 10 20 30 40 50 0 10 20 30 40 50
a=0.8 a=0.88
1.0
1.0
0.8
0.8
0.6
0.6
x(n)
0.4
0.4
0.2
0.2
0.0
0.0
0 10 20 30 40 50 0 10 20 30 40 50
n n
hd2 =: ’49’,:’50’
hd2; 0.8 gˆ:(49,50) 0.1 0.4 0.7
+--+--------------------------+
|49|0.799455 0.799455 0.513045|
|50|0.513045 0.513045 0.799455|
+--+--------------------------+
We can see that, for each initial condition, the system converges to the same two-
period state, albeit, for x(0) = 0.7, the trajectory is half a cycle out of phase with the
other two. This is illustrated in the graph in Fig 7.5 which shows the trajectories up
to N = 50 for each starting value x(0) = 0.1, 0.4 and 0.7.
Now, we compare two trajectories for a = 1 with starting conditions x(0) and x(0)+
ε, where ε = 10−6 (in this case) is the perturbation. It is reasonable to expect the
evolution of a system from a perturbed starting condition as relatively small as this
to remain close to the original (nonperturbed) throughout each iteration. Indeed, this
appears to be the case if we run the logistic map (for a = 1) up to N = 10 iterations:
0.8
0.6
x(n)
0.4
0.2
x0=0.1
x0=0.4
x0=0.7
0.0
0 10 20 30 40 50
Fig. 7.5. Three trajectories for the initial starting conditions of x(0) = 0.1, 0.4 and 0.7
+--+-----------------+
| 0| 0.1 0.100001|
| 1| 0.36 0.360003|
| 2| 0.9216 0.921604|
| 3|0.289014 0.289002|
| 4|0.821939 0.821919|
| 5|0.585421 0.585473|
| 6|0.970813 0.970777|
| 7|0.113339 0.113475|
| 8|0.401974 0.402392|
| 9|0.961563 0.961891|
|10|0.147837 0.146627|
+--+-----------------+
It can be seen that, as the map evolves through the iterations of n = 0, 1, . . . 10,
the two trajectories stay close together. However, if we run the map for a further 10
iterations (n = 11, . . . 20), the two trajectories begin to diverge:
0.8
x(n)
0.4
0.0
0 10 20 30 40 50
n
|f^N(x0) − f^N(x0+d0)|
0.8
0.4
0.0
0 10 20 30 40 50
Fig. 7.6. Two trajectories from the logistic map (top). The difference between the trajectories
(bottom)
+--+-----------------------+
|11| 0.503924 0.50051|
|12| 0.999938 0.999999|
|13|0.000246305 4.16748e_6|
|14|0.000984976 1.66698e_5|
|15| 0.00393603 6.66783e_5|
|16| 0.0156821 0.000266695|
|17| 0.0617448 0.0010665|
|18| 0.23173 0.00426144|
|19| 0.712124 0.0169731|
|20| 0.820014 0.0667401|
+--+-----------------------+
This is illustrated graphically in Fig 7.6 (top) for the first N = 50 iterations. The
divergence of the two trajectories becomes apparent at about iteration thirteen. The
bottom graph in Fig 7.6 shows the magnitude of the difference between the two
trajectories according to the expression:
7.1 Analysing Chaotic Behaviour 133
This leads us to the Lyapunov exponent [17] which serves as a metric for assessing
the rate at which a trajectory, with a perturbed starting value, diverges. The Lyapunov
exponent is given by the expression:
1
λ(x(0)) = lnE(N )/ε (7.5)
N
The Lyapunov exponent λ(x(0)) for the logistic map (x(0) = 0.1, ε = 10−6 and
N = 20) can be calculated thus:
Systems like the logistic map are highly sensitive to small errors in the initial
conditions. Such systems are chaotic and characterised by a Lyapunov exponent
λ(x(0)) > 0. Nonchaotic systems have Lyapunov exponents λ(x(0)) ≤ 0. Thus
for a = 0.8:
The J verb in Listing 7.1 is an explicit verb definition for calculating the difference
between two trajectories for the logistic map in Equation (7.3).
diff =: 4 : 0
’v0 N a’ =. x. [ ’x0’ =. rhs1 y.
’xn1 xn2’ =. a gˆ:(N) x0, (x0+v0)
xn1, | xn1-xn2
)
The verb diff takes three arguments which are passed on the left-hand side:
The initial value x(0) is passed on the right-hand side. For example:
The function returns two values. The second value is the actual (absolute) difference
between the two trajectories at iteration N = 20 (in this case). The first value is the
value of the last iteration of the map. The reason for returning this value is so that diff
can be run iteratively, using this value as the initial condition for sucessive iterations;
thus:
The lyap script for calculating the Lyapunov exponent is given in Listing 7.2.
Listing 7.2 Script for Calculating the Lyapunov Exponent
lyap =: 4 : 0
’v0 N a R’ =. x. [ ’x0’ =. y.
df =: rhs2"1 ((v0,N,a) diffˆ:(1 to R) x0)
(ln df%v0)%N
)
The verb lyap calls diff (iterated R times). Running the lyap script, and taking the
mean, gives the following results for various values of a:
The graph in Fig 7.7 shows the Lyaponov exponent over a range of values of a. Note
that for a = 0.5, the result is negative infinity (denoted by a double underscore: __).
This is a valid result and it is fortunate that J can deal with infinite values.
In this section, we introduce chaotic maps for modeling on/off traffic sources. The
state of the map determines whether or not the source is in a transmitting state (on) or
7.2 Chaotic Maps for Traffic Sources 135
0
−1
Lyaponv exponent
−2
−3
−4
Fig. 7.7. Lyaponov exponent for the logistic map in Equation (7.3) for a range of a and
N = 20
idle state (off). In this section we introduce two maps for this purpose: the Bernoulli
shift and the double intermittency map [17]. Both maps (under the right conditions)
exhibit chaotic behaviour, although the statistical properties of their respective tra-
jectories are significantly different. The double intermittency map can (for certain
parameters) produce lrd-ss sequences, while the Bernoulli shift is srd.
Both maps are one-dimensional, where x(n) evolves in time according to the trans-
formation:
f1 (x(n)) if 0 < x(n) ≤ d
x(n + 1) = (7.6)
f2 (x(n)) if d < x(n) < 1
In order to model an on/off traffic source model, an associated state variable y(n)
determines if the system is in an active state y(n) = 1 or an idle state y(n) = 0. The
state of the system is governed by the magnitude of x(n). If x(n) exceeds threshold
d, then the system transmits at a peak rate; otherwise it is idle:
0 if 0 < x(n) ≤ d
y(n) = (7.7)
1 if d < x(n) < 1
136 7 Chaotic Maps
Bernoulli Shift map (illustrated in Figure 7.8) consists of two linear segments and
takes one parameter d. The evolution of the state variable x(n) is given by the trans-
formation:
x(n)
⎧
⎪
⎨ if 0 < x(n) ≤ d
x(n + 1) = x(n) d (7.8)
− (d)
⎪
⎩ if d < x(n) < 1
1−d
For Bernoulli map verb, the parameter d is passed on the left of the verb and the
initial starting condition x(0) is passed on the right:
The verbs for the two linear segments are given by:
f1 =: x%d
f2 =: (x-d)%(1:-d)
xnext =: f1 ‘ f2 @. (d<x)
Note that the sequence order reads from left to right, top to bottom. The resultant
trajectory for the expression above is shown in Fig 7.9. The associated values of y
are given by:
While the Bernoulli shift map is chaotic, it is Markovian in nature. That is, the
sequence x(n) is short-range dependent. To verify this, we iterate the map for
N = 10, 000:
1.0
0.8
0.6
x(n)
0.4
0.2
0 10 20 30 40 50
Fig. 7.9. First 50 iterations of x(n) for the Bernoulli shift map, d = 0.75 and x(0) = 0.1
k =: col i.100
rx1 =: k autocor"1 x1
The graph in Fig 7.10 (top) shows that the autocorrelations decay exponentially with
the lag, indicating that x(n) is srd. For further confirmation, we calculate the variance
time plot:
m =: col 10 to 100
vx1 =: m varm"1 x1
The slope is, as expected, approximately −1 (bottom graph in Fig 7.10). Computa-
tion of the Hurst parameter yields a value close to 0.5 indicating srd:
hurst 0.952058
0.523971
Performing a similar analysis on the associated indicator variable y shows that it too,
is srd:
7.2 Chaotic Maps for Traffic Sources 139
autocorrelation
0.8
autocor
0.4
0.0
0 20 40 60 80 100
lag
variance−time plot
−1.6
●
● ●
● ●
●
●●
●●
● ●●
log10 Var
●
●●
−2.0
●●● ●
● ●●
●● ●●
● ●●● ● ●
● ●● ●
●●● ●
● ●●●●●●
●
●●●●
● ●●●
−2.4
● ●●●
●
●●● ●●
●●●●
●●● ●●
●●●●●●
●●●●●
●●
●●
log10 m
Fig. 7.10. Autocorrelation cofficient and variance-time plot for a Bernoulli shift map
y1 =: 0.75 < x1
vy1 =: m varm"1 y1
hd3,: ;/ (log10 vy1) %. 1,.log10 m
+---------+--------+
|intercept|slope |
+---------+--------+
|_0.742428|_1.00614|
+---------+--------+
hurst 1.00614
0.49693
One problem with this map that we should mention is the case for d = 0.5. Below
we run the map for N = 60 iterations:
We can see that the map converges to one. This is caused by the rounding of the
digital computer and is not a property of the map itself. However, J does provide
a solution to this problem. Instead of using floating point representation for d and
x(0), rationals can be used:
It is clear from the example above that the result does not suffer from the round-
ing problem. The graph in Fig 7.11 shows the trajectories for the floating point and
fractional representations of the parameter d and initial condition x(0).
Replacing the linear segments of the Bernoulli shift map with nonlinear segments
results in a map that can (for certain parametric values) generate long-range depen-
dent, self-similar trajectories. The double intermittency map, shown in Fig 7.12, is
given by the transformation:
ǫ1 + x(n) + c1 x(n)m
if 0 < x(n) ≤ d
x(n + 1) = (7.9)
1 − ǫ2 − (1 − x(n)) − c2 (1 − x(n))m if d < x(n) < 1
where:
1 − ǫ1 − d ǫ2 − d
c1 = and c2 = − (7.10)
dm (1 − d)m
The parameters d, m, ǫ1 and ǫ2 are (as usual) passed on the left of the verb and x(0)
on the right:
7.2 Chaotic Maps for Traffic Sources 141
1.0
d=0.5, x0=0.1
d=1r2, x0=1r10
0.8
0.6
x(n)
0.4
0.2
0.0
0 20 40 60 80 100
The J expressions for the intermediate parameters c1 and c2 from Equation (7.10)
are:
c1 =: (>:@-@e1 - d) % d ˆ m
c2 =: -@(e2 - d) % >:@-@d ˆ m
The expressions for the two (nonlinear) segments are given by:
f1 =: e1 + x + c1 * x ˆ m
f2 =: -@e2 + x - c2 * >:@-@x ˆ m
Thus, the transformation in Equation (7.9) is implemented in the same way as for the
Bernoulli shift map:
xnext =: f1 ‘ f2 @. (d<x)
The graph in Fig 7.13 shows the trajectory for the double intermittency map. For
analysis purposes, we run the map for N = 10, 000 iterations:
1.0
0.8
0.6
x(n)
0.4
0.2
0 10 20 30 40 50
Fig. 7.13. First 50 iterations of x(n) for a Double intermittency chaotic map
rx2 =: k autocor"1 x2
vx2 =: (col m) varm"1 x2
hd3,: ;/ (log10 vx2) %. 1,.log10 m
+---------+---------+
|intercept|slope |
+---------+---------+
|_0.625252|_0.352365|
+---------+---------+
The graphs in Fig 7.14 show the autocorrelation coefficients (top) and the variance
time plot (bottom). The autocorrelations decay, as a power curve suggesting the tra-
jectory, is long-range dependent. The slope of the variance time plot is greater than
-1 which is an indication of self-similarity. This is confrmed by the computation of
the Hurst parameter:
hurst 0.352365
0.823817
144 7 Chaotic Maps
autocorrelation
1.0
autocor
0.6
0.2
0 20 40 60 80 100
lag
variance−time plot
−1.05
● ●
● ● ●
●●
●
● ●●
●
●●●●
●
log10 Var
●●●●
●●●●
●●● ●
−1.20
●● ●●
● ●●●●●●
●●
●●●●
● ●
●●●●●
●●● ●
●●●● ●
● ●
●●
● ●●●● ● ●
●●● ●● ●
−1.35
●● ●●
●●●
●
●● ●
●
log10 m
Fig. 7.14. Autocorrelation cofficient and variance-time plot for a Double intermittency chaotic
map
In this section, we compare the queue dynamics of a work conserving link for srd
and lrd-ss processes, using the results of the Bernoulli shift and double intermittency
maps described above. We can generate the on/off traffic sequence for the double
intermittency map:
y2 =: 0.75 < x2
The on/off sequence y1 for the Bernoulli shift map was generated earlier (subsection
7.2.1). Comparing the average throughput of the respective traffic flows:
hd4 =: ’y1’;’y2’
hd4,: ;/ mean y1,.y2
+------+------+
|y1 |y2 |
+------+------+
|0.2539|0.2342|
+------+------+
7.3 Summary 145
For each traffic source (y1 and y2 ), we can calculate the backlog for each time interval
n, using the Lindley equation:
q1 =: (0.6;y1) lindleyˆ:(10000) 0
q2 =: (0.6;y2) lindleyˆ:(10000) 0
If we look at the mean backlog, we see that they are relatively similar:
hd5 =: ’q1’;’q2’
hd5,: ;/ mean q1,.q2
+--------+-------+
|q1 |q2 |
+--------+-------+
|0.164164|1.48381|
+--------+-------+
There is a small difference between the backlog q1 and q2 , although the mean
throughput for the Bernoulli shift map was slightly higher than for the double interm-
ittency. However, there is a more pronounced difference between the maximum back-
logs of the two flows:
The maximum backlog q2 is nearly 10 times higher than for q1 . The graph in Fig
7.15 shows the evolution of the queue sizes over time. It is clear that the queue
dynamics for the two traffic flows are significantly different. This reinforces the as-
sertion that the capacity planning of network resources should not be based solely
upon first order statistics alone. The degree of lrd-ss has a significant impact on the
performance seen at the buffer queues.
7.3 Summary
In this chapter we have used J to build and analyse chaotic maps. Chaotic behaviour
is determined by a system’s sensitivity to initial conditions. Long-term prediction
of a dynamical system is dependent upon the assumption that two (or more) trajec-
tories that have roughly (but not exactly) the same starting conditions will evolve
in roughly the same way. This assumption is not valid for chaotic systems, where
small perturbations in the starting conditions will result in widely varying outcomes
146 7 Chaotic Maps
Bernoulli shift
10 15 20 25
queue size
5
0
double intermittency
10 15 20 25
queue size
5
0
Fig. 7.15. Backlog for Bernoulli shift and double intermittency map traffic
Traffic flows through an ATM network are characterised by a number of traffic descr-
iptors. The peak cell rate (PCR) is the maximum rate at which a source may submit
cells to the network. The PCR is the reciprocal of the minimum cell spacing T ; thus
PCR = 1/T . Cells that do not exceed the PCR are deemed to be conforming. While
a source may submit conforming cells to the network, the effects of multiplexing
could cause jitter in the cell spacing, resulting in nonconformance of cells as they
propagate through the network. The network defines a cell delay variation tolerance
(CDVT) that allows small bursts over the PCR.
Over a period of time greater than T , the sustained cell rate (SCR) defines the limit
at which conforming cells may enter the network. A flow may be allowed to burst
over the SCR (up-to the PCR). The burst “period” is defined by the maximum burst
size parameter (MBS). The ATM Forum defines the following service categories:
The CBR service category is for time-sensitive applications that require a fixed capa-
city, as specified by the PCR. Conforming traffic may burst over the PCR up to
the CDVT. This service category is typically for circuit emulation, voice traffic or
constant bit rate video.
For VBR traffic, conforming traffic may burst over the SCR up to the MBS. Like the
CBR service category, it may burst over the PCR up to the CDVT.
The ABR service category is for traffic sources that can adapt their transmission rates
to the conditions of the network through flow-control methods. As well as a PCR,
the ABR service category also has a Minimum Cell Rate (MCR).
148 8 ATM Quality of Service
The UBR service category is defined by the PCR but there is no guaranteed through-
put. Applications using this service category must have a high tolerance to delay.
QoS is best-effort. In this chapter we focus on CBR and VBR service categories.
The Generic Cell Rate Algorithm (GCRA) is a theoretical algorithm that determines
whether a flow conforms to its contracted traffic descriptors. Cells that are deemed
nonconforming are either discarded or tagged. Cells that are tagged are marked as
low-priority. They may still pass through the network provided there is no conges-
tion, but will be discarded if there is. In terms of the CBR service category, the
GCRA is a function of two parameters I = 1/PCR and L = CDVT. GCRA(I,L)
can be implemented by either a virtual scheduling algorithm (VSA) or a leaky bucket
algorithm.
Four parameters are defined for the VBR service category: Ip = 1/PCR, Lp =
CDVT, Is = 1/SCR and Ls = BT. BT is the burst tolerance, and is given by:
The J verb for calculating the burst tolerance from the MBS is shown in Listing 8.1.
The dual virtual scheduling algorithm or the dual leaky bucket algorithm are used to
implement VBR service categories.
The theoretical arrival time (TAT) is the time that is compared to the arrival time
of the next cell ta in order to determine if it is conforming. If the cell arrives before
TAT − L, then it is nonconforming and conforming otherwise. The TAT is initialised
to ta when the first cell arrives. After checking the conformance of each cell, it is set
8.2 Virtual Scheduling Algorithm and Leaky Bucket Algorithm 149
to ta if the cell has arrived after the TAT, otherwise it is incremented by 1/PCR. The
VSA is shown in Fig 8.1.
We implement the VSA in J. As the VSA and the leaky bucket algorithm (imple-
mented below) share a number of common functions, we define these verbs in Listing
8.2. Listing 8.3 shows the virtual scheduling algorithm.
Generate some test data to demonstrate how the algorithm works. The sequence ta
is the cell arrival times:
150 8 ATM Quality of Service
ta =: 1 6 7 18 20 21
The verb takes the traffic contract parameters, I and L, as left arguments. The right
arguments are a boxed sequence. The first argument is the sequence of cell arrival
times ta . The next argument is a vector (list) of the conformance results. The func-
tion returns zero if a packet is conforming and one if it is nonconforming. It is ini-
tialised to a null list ’’. Conformance results are appended to the list as each cell
is processed. The last argument is the TAT (which is initialised to the arrival time
of the first cell). The example below shows the evolution of the virtual scheduling
algorithm with traffic contract parameters I = 4 and L = 2.
hd1 =: ’’;’ta’;’conform’;’TAT’
hd1, (col i.7) ;"1 (4 2 vsaˆ:(i.7) ta;’’;1)
+-+--------------+-----------+---+
| |ta |conform |TAT|
+-+--------------+-----------+---+
|0|1 6 7 18 20 21| |1 |
+-+--------------+-----------+---+
|1|6 7 18 20 21 |0 |5 |
+-+--------------+-----------+---+
|2|7 18 20 21 |0 0 |10 |
+-+--------------+-----------+---+
|3|18 20 21 |0 0 1 |10 |
+-+--------------+-----------+---+
|4|20 21 |0 0 1 0 |22 |
+-+--------------+-----------+---+
|5|21 |0 0 1 0 0 |26 |
+-+--------------+-----------+---+
|6| |0 0 1 0 0 1|26 |
+-+--------------+-----------+---+
An examination of the last iteration shows that cells three and six were nonconform-
ing. The conformance results can be extracted thus:
conform_z_ =: >@rhs2
conform 4 2 vsaˆ:(6) ta;’’;1
0 0 1 0 0 1
The leaky bucket algorithm defines a bucket with a maximum capacity L that leaks
at a rate of 1/I (the PCR). When a cell arrives, the bucket fills by I. The algorithm
records the occupancy of the bucket B and the last conformance time LCT. A cell is
conforming provided the bucket is not full upon its arrival; that is, B − (ta − LCT)
does not exceed L.
The J verb for the implementation of the leaky bucket algorithm is shown in Listing
8.4 (see Fig 8.2):
8.2 Virtual Scheduling Algorithm and Leaky Bucket Algorithm 151
As with the VSA, the traffic contract parameters are passed as left arguments. Fur-
thermore, the first two (boxed) right arguments are the cell arrival times ta and con-
formance results vector (initialised to null). The third argument is the LCT and ini-
tialised to the arrival time of the first cell. The last argument is the bucket occupancy
B, which is initialised to zero. For I = 4 and L = 2; the evolution of the leaky
bucket algorithm is:
hd2 =: ’’;’ta’;’conform’;’LCT’;’B’
hd2, (col i.7) ;"1 (4 2 lbˆ:(i.7) ta;’’;1;0)
+-+--------------+-----------+---+-+
| |ta |conform |LCT|B|
+-+--------------+-----------+---+-+
|0|1 6 7 18 20 21| |1 |0|
+-+--------------+-----------+---+-+
|1|6 7 18 20 21 |0 |1 |4|
+-+--------------+-----------+---+-+
|2|7 18 20 21 |0 0 |6 |4|
+-+--------------+-----------+---+-+
|3|18 20 21 |0 0 1 |6 |4|
+-+--------------+-----------+---+-+
152 8 ATM Quality of Service
It can be seen that the results for the conformance of cells are the same as the VSA.
8.2.1 Jitter
We demonstrate how the CDVT can be used to account for cell jitter. Randomly se-
lecting cells to jitter (with a probability of 0.4) by generating a sequence of Bernoulli
trials:
]b =: *rnorm 10
1 1 _1 _1 1 _1 1 1 1 _1
Note that, the use of RNGs above will yield different results for a and b each time
the command-lines above are issued. In order to replicate the results here, set a and
b explicitly:
The product of the sequence above results in a sequence of “jitter” values that are
added to the sequence of packet times.
]jitter =: a*b
1r8 1r8 0 0 1r8 0 0 1r8 0 0
For a CBR service with PCR=4 cells per unit time, the flow ta is conforming, as the
minimum spacing between cells is 1/4 (time units):
]taj =: ta+jitter
3r8 5r8 3r4 1 11r8 3r2 7r4 17r8 9r4 5r2
min ipa taj
1r8
If we run the leaky bucket algorithm with CDVT = 0 on the jittered cell times, we
get nonconforming cells:
However, if we set CDVT = 1/8, then all cells in the (jittered) flow are deemed to
be conforming:
For VBR services, the traffic contract parameters are Is , Ip , Ls and Lp . Listing 8.5
shows the common functions for the dual VSA and the dual leaky bucket algorithms.
Listings 8.6 and 8.7 show the J verb definition for the dual VSA (Fig 8.3) and dual
leak-bucket algorithm (Fig 8.4), respectively.
154 8 ATM Quality of Service
Listing 8.5 Common Functions for Dual VSA and Dual Leaky Bucket
cocurrent < ’GCRA’
Is =: lhs1
Ip =: lhs2
Ls =: lhs3
Lp =: lhs4
cocurrent < ’base’
ta2 =: 1 3 5 6 7 8 10 14 17 20
hd3 =: ’ta’;’conform’;’TATs’;’TATp’
hd3, 4 2 7 2 dvsaˆ:(i.11) ta2;’’;1;1
+-----------------------+-------------------+----+----+
|ta |conform |TATs|TATp|
+-----------------------+-------------------+----+----+
|1 3 5 6 7 8 10 14 17 20| |1 |1 |
+-----------------------+-------------------+----+----+
|3 5 6 7 8 10 14 17 20 |0 |5 |3 |
+-----------------------+-------------------+----+----+
|5 6 7 8 10 14 17 20 |0 0 |9 |5 |
+-----------------------+-------------------+----+----+
|6 7 8 10 14 17 20 |0 0 0 |13 |7 |
+-----------------------+-------------------+----+----+
8.4 Analysing Burst Tolerance 155
|7 8 10 14 17 20 |0 0 0 0 |17 |9 |
+-----------------------+-------------------+----+----+
|8 10 14 17 20 |0 0 0 0 1 |17 |9 |
+-----------------------+-------------------+----+----+
|10 14 17 20 |0 0 0 0 1 1 |17 |9 |
+-----------------------+-------------------+----+----+
|14 17 20 |0 0 0 0 1 1 0 |21 |12 |
+-----------------------+-------------------+----+----+
|17 20 |0 0 0 0 1 1 0 0 |25 |16 |
+-----------------------+-------------------+----+----+
|20 |0 0 0 0 1 1 0 0 1 |25 |16 |
+-----------------------+-------------------+----+----+
| |0 0 0 0 1 1 0 0 1 0|29 |22 |
+-----------------------+-------------------+----+----+
Running the dual leaky bucket algorithm on ta2 shows that the conformance results
are the same as the virtual scheduling algorithm:
In this section, we analyse the burst tolerance parameter of the GCRA with respect to
the srd and lrd-ss variable bit rate sources. In Section 6.5 we presented a number of
discrete on/off traffic models. These models produced traffic as a number of arrivals
156 8 ATM Quality of Service
per (discrete) time interval. However, the GCRA requires traffic in the form of a
sequence of cell (or packet) arrival times. Fig 8.5 shows the Markov model for a
continuous on/off source.
Like the discrete Markov model, the source transmits at a constant rate during the
on period and is idle during the off period. However, the time periods are not repre-
sented as discrete time units, but are instead continuous. The lengths of the on and
off periods are determined by the respective transition frequencies a and b. As we
have seen from the discrete models, the superposition of on/off sources with heavy-
tailed distributions leads to lrd-ss traffic. The same applies to continuous models. We
present two J verbs, one for generating srd and the other lrd-ss.
The J verb oosrdc in Listing 8.8 generates cell arrivals times according to exponen-
tially distributed on and off times (Exp[on]-Exp[off]).
The J verb oolrdc in Listing 8.9 generates cell arrivals times according to exponen-
tially distributed on and Pareto distributed off times (Exp[on]-Par[off]).
The oosrdc verb takes three left parameters, the transition frequencies of the on and
off periods, and the peak transmission rate (in cells of packets per unit of time). We
generate srd traffic for a = 8, b = 12 and rpeak = 1/2 (thus the mean packet inter-
arrival time is T = 2). We show that the average transmission rate is approximately
0.2, by dividing the number of packets by the difference between the first and last
arrival time:
Given the values of the parameters a, b and rpeak we can compute the average trans-
mission rate:
a 1 8
rpeak = × = 0.2 (8.2)
a+b 2 8 + 12
The verb oolrdc takes the same parameters as oosrdc, except for the transition α of
the Pareto distribution.
2 mpar 1.2
12
The mean transmission rate for a = 8, α = 1.2 and rpeak = 1/2 is:
Now, we can use these source models to examine the effect of the burst tolerance
(BT) parameter on conformance. We generate five lrd-ss continuous on/off sources
and “aggregate” them by sorting them in ascending order of arrival time. We then
take a sample from the middle of the sequence:
hd4 =: ’min’;’max’
x1 =: sort ; (2 1.2 1) (oolrdc"1) (col 5 # 1000)
hd4,: (min;max) (tal =: (2001 to 12000) { x1)
+-------+-------+
|min |max |
+-------+-------+
|1030.12|6943.56|
+-------+-------+
Calculate the mean transmission rates of both the lrd-ss flow and srd flow by dividing
the number of cells by the difference between the first and last arrival times:
hd5 =: ’lrd-ss’;’srd’
hd5,: ;/ (#%max-min)"1 tal,:tas
+------+-------+
|lrd-ss|srd |
+------+-------+
8.4 Analysing Burst Tolerance 159
|1.8953|1.69114|
+------+-------+
In order to verify that traffic flows are lrd-ss and srd respectively, the flow is converted
from its cell arrival time form to cells per (unit) time interval:
We can confirm that the lrd-ss traffic process shows a reasonably high degree of
self-similarity, with H ≈ 0.86:
hd6 =: ’intercept’;’slope’
m =: col 10 to 100
vl =: m varm"1 al
hd6,: ;/ (log10 vl) %. 1,.log10 m
+---------+---------+
|intercept|slope |
+---------+---------+
|0.0709503|_0.283643|
+---------+---------+
hurst 0.283643
0.858178
Furthermore, for the srd traffic flow, H ≈ 0.55, indicating that it is indeed short-
range dependent:
vs =: m varm"1 as
hd6,: ;/ (log10 vs) %. 1,.log10 m
+---------+---------+
|intercept|slope |
+---------+---------+
|0.441152 |_0.898582|
+---------+---------+
hurst 0.898582
0.550709
hd7 =: ’Is’;’Ip’;’Ls’;’Lp’
hd7,: ;/TC1 =: 1r3 1r5 0 1r5
+---+---+--+---+
|Is |Ip |Ls|Lp |
+---+---+--+---+
|1r3|1r5|0 |1r5|
+---+---+--+---+
160 8 ATM Quality of Service
Note that, we set the burst tolerance (Ls ) to zero. The J expression below computes
the conformance of both flows using the dual leaky bucket algorithm. It is necessary
to initialise ta (0) for each flow to the time of the first packet. The initialisation values
are given by computation of the minimum of x1 and x2 above:
We now examine the effect of the burst tolerance (BT) on cell conformance. Define
a new traffic contract T C2 . The parameters Is , Ip , Lp remain the same but Ls is set
to 1/3.
We run the dual leaky bucket algorithm for the new traffic contract:
For a nonzero burst tolerance, the proportion of nonconforming cells is reduced for
both flows; however, for the srd flow, the reduction is far more pronounced:
8.5 Summary
ATM specifies a number of service categories, which in turn are defined by a number
of traffic descriptors. In this chapter we have focused on two particular service cat-
egories: CBR and VBR. The conformance of traffic flows to either of these service
categories is determined by the Generic Cell Rate Algorihtm (GCRA). Either the
virtual scheduling algorithm (VSA) or leaky bucket algorithm can be used for the
GCRA.
The single VSA or leaky bucket algorithm is used for testing conformance to the
CBR service category, whereas the dual version of the algorithm is used for the VBR
service category.
We generated srd and lrd-ss traffic using a continuous on/off traffic model imple-
mented in J. We analysed the conformance of simulated traffic using the GCRA
(dual leaky bucket). Traffic that is lrd-ss yields higher conformance failure rates over
comparable srd traffic.
9
Congestion Control
Congestion control and avoidance, introduced by Van Jacobson [29] in 1988, has
had a significant effect on the stability of the Internet. The TCP sender maintains a
congestion window that determines the number of unacknowledged segments that it
can deliver to a receiver. When the sender has transmitted an entire window of data,
it must wait until it receives an acknowledgement before it can slide the window
along and release more data into the network. Therefore, the sender’s data rate is
constrained by the reciprocal of the round-trip time delay.
The sender will, however, adjust the congestion window during the course of a ses-
sion. It initialises the congestion window to a low value (e.g., one or two segments)
and increases it each time an acknowledgement is received. In this way, the sender
probes the network for available capacity. When the sender detects congestion in
the network (typically inferred after packet loss), it responds by reducing its conges-
tion window. Having dropped its congestion window (and therefore its transmission
rate), the sender once again starts probing the network. How aggressively the sender
probes the network and how conservatively it responds to congestion is governed by
the algorithm and its parameters.
TCP ensures reliable data delivery by retransmitting unacknowledged segments. The
delay incurred by retransmitting segements is a problem for certain applications,
such as real-time audio and video, where dropped packets are preferred to late pack-
ets. The alternative is to use the UDP (User Datagram Protocol) transport protocol,
but this has no congestion control mechanism at all. However, a number of TCP-
compatible algorithms have been proposed and examined [75] for emerging Internet
transport protocols, such as DCCP (Datagram Congestion Control Protocol) [24].
DCCP is designed for real-time applications, specifically audio, video and online
gaming. There has been a growing interest in the analysis of these algorithms in or-
der to understand, not only how they can provide adequate congestion control for
multimedia applications, but also what effect they have on existing TCP congestion
controlled flows.
164 9 Congestion Control
In this section, we present a simple congestion control model based upon the one
introduced in [63]. We consider traffic flows from two sources transmitting over a
bottleneck link of capacity c. We assume that each source j is greedy and transmits
up to the rate of its congestion window w = {wj , j = 1, 2} (per time interval). The
offered load to the communications link at any time t is w1 (t) + w2 (t).
Congestion occurs when the aggregate transmission rate of the two sources exceeds
the capacity of the link. Since we assume that both sources are greedy, then the
link experiences congestion when w1 (t) + w2 (t) > c. Icon and Icon are indicator
functions that signal a congestion condition on the link:
1 if w1 (t) + w2 (t) > c
Icon = (9.1)
0 if w1 (t) + w2 (t) ≤ c
1 if w1 (t) + w2 (t) ≤ c
Icon = (9.2)
0 if w1 (t) + w2 (t) > c
The congestion window for each source j evolves according to the feedback equa-
tion:
wj (t + 1) = wj (t) + αIcon − βIcon (9.3)
load ’libs.ijs’
Define c, α and β:
cocurrennt <’CWND’
c =: lhs1 NB. get 1st left parameter
alpha =: lhs2 NB. get 2nd left parameter
beta =: lhs3 NB. get 3rd left parameter
w =: rhs0
The flows wj are summed and then checked to see if the resulting sum exceeds the
link capacity c. The two mutually exclusive indicator variables Icon and Icon (Incon)
set accordingly:
We ensure that the window size does not drop below a minimum threshold (set arbi-
trarily to 0.001 in this case). Finally, we define the verb cwnd:
We execute the function with parameters c = 1, α = 0.3 and β = 0.4 , and the initial
conditions w1 (0) = 0.3 and w2 (0) = 0.1:
It shows that congestion occurred by iteration two, as both flows reduced their win-
dow size in the next iteration. In this example. while w1 and w2 have different start-
ing points, their parameters (and thus their response to the network conditions) are
the same. However, we can give each flow different parameters by constructing a
parameter matrix:
Here, we set α1 = 0.1, β1 = 0.15, α2 = 0.2 and β2 = 0.4. As the flows share a
common link, then: c1 = c2 = 1. Now, each flow probes the network for capacity
and responds to congestion differently:
While the feedback model we developed in Equation (9.3) is for two flows only, we
can, in fact, process an arbitrary number of flows, provided we pass a parameter ma-
trix of the appropriate order and with a corresponding number of initial conditions.
For the purpose of illustration the parameters of the three flows are chosen to be:
The graph in Fig 9.1 shows the congestion control window (and thus transmission
rate) for all three flows. While this example is somewhat artificial, it does provide
some insight into the effects that the parameters α (how aggressively the network is
probed) and β (how conservative is the response to congestion) have on the allocation
of resources amongst the flows.
This model illustrates the fundamental principles behind Internet congestion con-
trol, as well as introducing how to develop functions in the J programming language.
Actual Internet congestion control algorithms are far more complex than the model
presented here. Furthermore, any flow’s reaction to network conditions is regulated
by its round-trip. A flow with large round-trip times will not increase its window as
rapidly as a flow with small round-trip times. Nor will it respond to congestion as
quickly. With our current model, flows are synchronised; that is, they experience the
same round-trip times and thus respond to network conditions at the same time (in the
next time interval). In the next two sections, we develop models for TCP-compatible
and TCP congestion control algorithms that incorporate a number of enhancements
and improve on this simple example. These models reflect more closely the behav-
iour of the actual Internet congestion control algorithms. They also account for the
variance in round-trip times across different flows.
The binomial congestion control algorithm below defines a set of congestion control
algorithms [3, 30, 56]:
9.2 Binomial Congestion Control Algorithms 167
1.0
flow 1
flow 2
flow 3
0.8
0.6
cwnd
0.4
0.2
0.0
5 10 15 20
time
The parameters k and l define the nature of window increase and decrease, e.g, k =
0 and l = 1 defines an algorithm with an additive increase and a multiplicative
decrease (AIMD). Other algorithms include multiplicative increase, multiplicative
decrease (MIMD) and additive increase, additive decrease (AIAD). Table 9.1 shows
corresponding values of k and l for various algorithms.
The parameters α and β allow for further control of the increase and decrease terms,
but do not alter the nature of the algorithm. That is, AIMD still increases the window
additively and decreases it multiplicatively, irrespective of the values of α and β.
We use α = 1 and β = 0.5 throughout this chapter. The function wj (t) gives the
congestion window size for the j th flow:
where dRT Tj is the acknowledgement round-trip time for flow j, wj△ (t) is the win-
dow size increase upon receiving an acknowledgement and wj▽ (t) is the window size
decrease in response to congestion, where wj△ (t) and wj▽ (t) are given by:
The aggregate offered load a(t) to the network is the sum of the individual flow
rates in the time interval t. We assume that all flows are greedy and transmit up to
the maximum rate allowed by the congestion window, which we take to be rj (t) =
wj (t)/dRT Tj ; thus a(t) is:
j=N
a(t) = rj (t) (9.7)
j=1
In our initial example presented in Section 9.1, the contention resource was a buffer-
less link. A congestion condition occurs when the aggregate flow exceeded the ca-
pacity a(t) > c. Here, we consider a communication link with a buffer queue. We
use the Lindley equation [39] to determine the backlog at the communications link.
The buffer queue is finite, so we drop any traffic that exceeds b:
The congestion/no congestion indicators Icon and Icon are given by the two expres-
sions below:
1 if q(t) > b
Icon = (9.9)
0 if q(t) ≤ b
1 if q(t) ≤ b
Icon = (9.10)
0 if q(t) > b
The parameters to this function are c, b, α, β , k, l and dRT T (refer to Table 9.2 for
associated mathematical and J terms). These are passed as a left argument and are
processed by the functions:
RTT =: lhs1
c =: lhs2
b =: lhs3
alpha =: lhs4
beta =: lhs5
k =: lhs6
l =: lhs7
The window size w, backlog q, time t and the cumulative number of acknowledge-
ments ack are passed as boxed right arguments:
t =: >@rhs1
w =: >@rhs2
q =: >@rhs3
ack =: >@rhs4
tx =: >@rhs5
170 9 Congestion Control
The aggregate flow (offered load) (a) and backlog (qnext) are calculated, then the
congestion/no congestion indicators (Icon and Icon respectively) are set accordingly
(depending upon whether the backlog exceeds the buffer threshold):
txnext =: w%RTT
a =: +/@txnext NB. aggregate flow
backlog =: max0@(a + q - c) NB. calculate backlog
Incon =: backlog <: b NB. no congestion
Icon =: -.@Incon NB. congestion
qnext =: b <. backlog
For each iteration of the congestion control algorithm, we compute a stair function
nack (t) = ⌈t/dRT T ⌉. When nack (t+1) > nack (t), a round-trip time has expired and
an acknowledgement has been received (or at least should have been). The J function
acknext computes nack (t + 1). The indicator function Iack signals that an acknowl-
edgement has arrived or should have arrived. We use this signal to defer the change
in window size, whether it is an increase due to the receipt of an acknowledgement
or a decrease as a result of congestion. The indicator function Inack signals that an
acknowledgement is pending:
The verbs wi and wd implement the window increase and decrease functions wj△ (t)
and wj▽ (t), respectively. We use the ceiling function to ensure that the window sizes
are an integer number of segments:
The window is increased if there has been no congestion (Icon = 1), though we defer
the change until Iack = 1 (implying an acknowledgement). The window is decreased
if there has been congestion (Icon = 1), and again we use the Iack = 1 condition to
defer the change:
h1 =: (w * Inak) + wi * Iack
h2 =: (w * Inak) + wd * Iack
h3 =: (h1 * Incon) + h2 * Icon
are dropped from the buffer queues of the router. In the event of congestion, not all
flows will necessarily have their packets dropped. Also, flows with large round-trip
times will detect congestion events less frequently than flows with shorter round trip
times, and will thus respond less rapidly.
We ensure that the window size is at least one segment. The verb h4 then returns the
boxed results of the next state of the system:
tcpf_z_ =: h4_TCPC_
9.2.1 Analysis
We define the matrix P1 and the vector of boxed elements X0 to represent the sta-
tic parameters and initial conditions, respectively. We define the vector dRT T =
{dRT Tj , j = 0, 1, . . .}, where dRT Tj = j + 1:
RTT =: >:@i.10
The other system parameters are the same for all flows: c = 10, b = 5, α = 1,
β = 0.5 k = 0 and l = 1; thus P1 defines the parameters for ten AIMD flows:
hd1=:’RTT’;’c’;’b’;’alpha’;’beta’;’k’;’l’
P1 =: RTT,(10 $ &> 10 5 1 0.5 0 1)
hd1,. ;/ P1
+-----+---------------------------------------+
|RTT |1 2 3 4 5 6 7 8 9 10 |
+-----+---------------------------------------+
|c |10 10 10 10 10 10 10 10 10 10 |
+-----+---------------------------------------+
|b |5 5 5 5 5 5 5 5 5 5 |
+-----+---------------------------------------+
|alpha|1 1 1 1 1 1 1 1 1 1 |
+-----+---------------------------------------+
|beta |0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5|
+-----+---------------------------------------+
|k |0 0 0 0 0 0 0 0 0 0 |
+-----+---------------------------------------+
|l |1 1 1 1 1 1 1 1 1 1 |
+-----+---------------------------------------+
172 9 Congestion Control
For time t = 0, the state conditions are initialised wj (0) = 1, q(0) = 0, nack = 1
and rj (t) = 0 for all j:
X0 =: 0;(;/ 10 $ &> 1 0 1 0)
hd2=:’t’;’w’;’q’;’ack’;’r’
hd2,. X0
+---+-------------------+
|t |0 |
+---+-------------------+
|w |1 1 1 1 1 1 1 1 1 1|
+---+-------------------+
|q |0 0 0 0 0 0 0 0 0 0|
+---+-------------------+
|ack|1 1 1 1 1 1 1 1 1 1|
+---+-------------------+
|r |0 0 0 0 0 0 0 0 0 0|
+---+-------------------+
The J expression below returns the state of the system for the first 200 iterations of
the AIMD algorithm:
S1 =: P1 tcpfˆ:(i.200) X0
We can extract individual state variables; for instance the transmission rate, with:
tput1 =: tx_TCPC_"1 S1
The graph in Fig 9.2 shows the evolution of the transmission rate state variables for
each flow (tput1). We can calculate the mean and peak transmission rate for each
flow. The top plane is the mean transmission rate and the bottom plane is the peak
transmission rate:
We can compute the aggregate throughput on the link by summing across the flows.
We can then derive the mean and peak aggregate throughput:
9.2 Binomial Congestion Control Algorithms 173
The aggregate throughput represents the offered load to the communications link,
which at times exceeds the capacity of the link. Traffic in excess of the capacity
c = 10 is buffered, while buffered traffic in excess of the maximum queue size b = 5,
is dropped. The graph in Fig 9.3 shows the aggregate throughput (offered load) for
the AIMD algorithm. The backlog state variable is also of interest as it gives us some
insight into the queue dynamics. Not surprisingly, the maximum backlog is five:
q1 =: {."1 q_TCPC_"1 S1
hd3,: (mean; max) q1
+-------+---+
|mean |max|
+-------+---+
|3.24953|5 |
+-------+---+
The evolution of the state variables for 200 iterations of the MIMD algorithm is given
below:
S2 =: P2 tcpfˆ:(i.200) X0
The per-flow and aggregate flow throughput are, as with the AIMD algorithm, deri-
ved by:
The mean and peak of the aggregate throughput are given by:
8
6
throughput
4
2
0
The graph in Fig 9.4 shows the aggregate throughput for the MIMD algorithm. It
can be seen that the aggregate throughput peaks are very high. Offered loads like this
will fill the buffer queues quickly, resulting in high levels of traffic loss. It can be
seen that the average queue occupancy for the MIMD algorithm is far higher than
for AIMD and quite near to the peak:
q2 =: {."1 q_TCPC_"1 S2
hd3,: (mean;max) q2
+-------+---+
|mean |max|
+-------+---+
|4.01483|5 |
+-------+---+
For the AIAD algorithm, we set k = 1 and l = 0. The parameter matrix P3 is,
therefore:
15
10
throughput
5
0
We merely have to repeat the procedure above, using P3 to derive the AIAD per-flow
(tput3) and aggregate throughput (agg3):
S3 =: P3 tcpfˆ:(i.200) X0
tput3 =: tx_TCPC_"1 S3
agg3 =: +/"1 tput3
hd4 =: ’’;’AIMD’;’MIMD’;’AIAD’
(mean;max) agg1,.agg2,.agg3
+----+-------+-------+-------+
| |AIMD |MIMD |AIAD |
+----+-------+-------+-------+
|mean|10.2667|11.5196|10.4042|
+----+-------+-------+-------+
|max |14.6413|21.5246|14.6413|
+----+-------+-------+-------+
176 9 Congestion Control
20
15
throughput
10
5
0
There is no single standardised congestion control algorithm for TCP. For one, there
are a number of TCP implementations (for example: Tahoe, Reno NewReno, Ve-
gas, Hybla, BIC, SACK and Westwood), each with a different congestion control
algorithm. Furthermore, there are variations within each implementation (which can
depend on thdepend on the operating system). Tahoe maintains a congestion window
that is increased multiplicatively or additively, depending upon whether the session
is in the slow-start or congestion avoidance phase. In the event of congestion, Tahoe
reduces its congestion window to one segment. For congestion events triggered by
a timeout, both reduce their congestion window to one. In this section, we build a
model of TCP congestion control algorithm (loosely) based on Tahoe, as described
by [63].
TCP has two congestion window increase phases: slow-start and congestion avoid-
ance. A TCP session starts in the slow-start phase, setting the congestion window
to a small value (one segment). The session sends one segment of data. Upon rec-
eiving an acknowledgement, it increases the window size by one and transmits data
up to the new window size (now two segments). It continues to do this until the
9.3 Model of TCP Congestion Control 177
15
10
throughput
5
0
where ωj△ (t) is the window size increase upon receiving an acknowledgement, and
ωj▽ (t) is the window size decrease in response to congestion. With the TCP model
(unlike the TCP-compatible model), the transmission rate is capped by the receiver’s
flow control window ωflow . The respective expressions for ωj△ (t) and ωj▽ (t) are:
If the current window size exceeds the slow-start threshold, the TCP congestion win-
dow undergoes a multiplicative increase; otherwise it undergoes an additive increase.
178 9 Congestion Control
The slow-start and congestion avoidance stages are defined by the value of k:
0 ωj (t) ≤ δssthreshj (t) (slow-start)
k= (9.13)
−1 ωj (t) > δssthreshj (t) (congestion avoidance)
where δssthreshj is the value of the slow-start threshold for flow j. The slow-start
threshold is set to half of the current window size, if congestion occurs:
The parameters to this function are the link capacity c, the buffer size b, α, the round-
trip time dRT T (RTT) and the receiver flow control window is wflow (flow).
We do not need the window decrease parameters (β and l) as ωj▽ (t) = 1. However,
if we wished to implement a Reno version of the TCP congestion control algorithm,
we would need to reinstate them. The window increase parameter k is “hardcoded,”
and is either 1 or 0 depending upon whether it is in slow-start or congestion avoid-
ance phase. We can (re)use some of the functions from the binary congestion control
algorithms verbs; thus we only have to define one new parameter (flow) and one new
state variable (ssthresh):
cocurrent <’TCP’
flow =: lhs6
ssthresh =: >@rhs6
We compute k based upon the current window size relative to the slow-start thresh-
old, and calculate the window increase and decrease:
If the current window size is less than or equal to the slow-start threshold, then k =
1 and the window is increased multiplicatively as per slow-start. Otherwise k =
0 and the window increase is additive as per congestion avoidance. Note that we
will still pass the β, even though wd does not use it. We continue to pass β for
two reasons. The first reason is for convenience; the TCP congestion control verb
would need some significant redevelopment, if it was removed. The other reason
is that, for some TCP implementations, such as Reno, when three duplicate acks
are received, instead of setting the congestion control, window to one segment, it is
multiplicatively decreased (typically it is halved) and fast recovery is initiated. With
fast recovery, the algorithm goes straight into congestion avoidance rather than slow-
start. If we were to model this behaviour of TCP congestion control we would need
the parameter β.
If an acknowledgement has been received, we recalculate the window according to
congestion conditions of the network:
9.3 Model of TCP Congestion Control 179
If there has been congestion, the slow-start threshold is set to half the current window
size (using the -: primitive). To ensure that it is an integer value and at least one,
ceil and max1 are applied, respectively:
g1 =: ceil@-:@ wnext
g2 =: max1@g1
g3 =: (ssthresh * Inak_TCPC_) + g2 * Iack_TCPC_
ssthnext =: (ssthresh*Incon_TCPC_) + g3 * Icon_TCPC_
In addition to the congestion window advertised by the sender, the TCP receiver
advertises a flow-control window. We, therefore, cap the transmission rate, if the
congestion window exceeds the flow-control window:
h4 =: (flow%RTT_TCPC_) ,: txnext_TCPC_
txnext =: min"2@h4 NB. apply minimum cwnd
Next, we prepare to output the results of the current iteration to be fed back into the
next iteration of the system. We could do this in one step, although we separate it
into multiple lines for brevity:
tcp_z_ =: h7_TCP_
9.3.1 Analysis
If we consider only one flow, we can examine the slow-start and congestion avoid-
ance behaviour of TCP:
We can run the TCP congestion control algorithm for ten flows by setting the para-
meter matrix P4 and initial starting conditions Y0 :
180 9 Congestion Control
12
10
8
throughput
6
4
2
0
0 2 4 6 8
Fig. 9.6. The transition of a TCP flow from the slow-start phase (multiplicative increase) to
the congestion avoidance phase (additive increase)
S4 =: P4 tcpˆ:(i.200) Y0
tput4 =: tx_TCPC_"1 S4
agg4 =: +/"1 tput4
The graph in Fig 9.7 shows the aggregate throughput (agg4) for TCP.
Here we analyse the second flow (the flow for which dRT T2 = 2) using the network
calculus methods from Chapter 4. The effective bandwidth algorithm was given in
Equation (4.39). We can, therefore, compute the effective bandwidth of the an indi-
vidual TCP flow by deriving the cumulative arrivals for the flow and expressing them
as a function A:
load ’netcalc.ijs’
delay =: (i.20)%5
D =: [ NB. pass delay bound as left argument
4 5 $ delay max@((A@t - A@s) % ((t-s) + D)) &> 199
7 5.90909 5.41667 5 4.73684
4.5 4.28571 4.09091 3.92857 3.7931
3.66667 3.54839 3.50123 3.49265 3.48411
3.47561 3.46715 3.45874 3.45036 3.44203
15
10
throughput
5
0
9.4 Summary
Scripts
for =: @i.
ei =: (}:@(-@i.@-)),i. NB. -(x-1)..0..(x-1)
not_z_ =: -.
NB. Prerequisites
load ’libs.ijs’
NB. g-clipper
cocurrent < ’CLIPPER’
Blist =: rhs0
t =: #@Blist
s =: i.@t
Alist =: lhs0
ind =: <:@#@Blist
Bprev =: {:@Blist
Aprev =: ind { Alist
Anext =: >:@ind { Alist
f1 =: min@(Blist + g@(t-s))
f2 =: Bprev + A@t - A@(<:@t)
Bnext =: min@(f1,f2)
cocurrent <’base’
gclipper_z_ =: Blist_CLIPPER_,Bnext_CLIPPER_
NB. Prerequisites
load ’libs.ijs’
sp =: [: +/ *&mdev
ssp =: [: +/ @ (*&mdev)˜
cov =: sp % dof
cor =: cov % (*&std)
cocurrent < ’base’
g1 =: (#@Xt)
g2 =: <.@(g1%m)
g3 =: g2*m
g4 =: (i.@g3) { Xt
f1 =: (-@m) +/\ g4
f2 =: f1%m
f3 =: var"1@f2
A.3 Scripts from Chapter 5 189
NB. Geometric
cocurrent <’RGEO’
p =: %@lhs1
n =: rhs1
rate =: %@p
NB. f1 =: rate (exprand) n
f1 =: rexp@n
f2 =: ˆ.@(1:-p)
f3 =: -@f1%f2
f4 =: ceil@>:@f3
cocurrent <’base’
rgeo_z_ =: f4_RGEO_
NB. Pareto
f1 =: runif@n
f2 =: %@>:@-@f1
f3 =: %@alpha
f4 =: beta*(f2ˆf3)
cocurrent < ’base’
rpar_z_ =: f4_PAR_
mpar_z_ =: *%<:@]
NB. Prerequisites
load ’libs.ijs’
load ’stats.ijs’
g1 =: (#@Xt)
g2 =: <.@(g1%m)
g3 =: g2*m
g4 =: (i.@g3) { Xt
f1 =: (-@m) +/\ g4
f2 =: f1%m
f3 =: var"1@f2
g1 =: coefs ip et
cnext =: 0:,}:@coefs
f1 =: *@ coefs
f2 =: |.@f1
f3 =: +/\@f2
mask1 =: |.@(*@f3)
mask2 =: not@mask1
f5 =: <:@(+/@mask1)
f6 =: +/@mask2
f7 =: f5 {. et NB. -p to (i-1) elements
f8 =: (-@f6) {. et NB.(i+1) to n elements
xnext =: f7,g1,f8 NB. insert u(i)
cocurrent < ’base’
ar_z_ =: xnext_AR_,:cnext_AR_
NB. Coefficients
cocurrent < ’ARIMA’
d =: lhs1
n =: rhs0
f1 =: */\@ (i.@n-d) NB. -d, -d(1-d), -d(1-d)(2-d) ...
f2 =: 1:, -@f1 NB. 1, d, d(1-d), d(1-d)(2-d) ...
f3 =: !@i.@>:@n NB. 0!, 1!, 2! ...
f4 =: f2%f3
cocurrent < ’base’
fdcoefs_z_ =: f4_ARIMA_
c =: lhs0
nc =: #@c
en =: [: >@{. ]
xt =: [: >@{: ]
xn =: xt {˜i.@ <:@nc
et =: {.@en
enext =: }.@en
g1 =: c*(et,xn)
g2 =: +/@g1
g3 =: enext;(g2,xt)
cocurrent < ’base’
fdiff_z_ =: g3_ARIMA_
NB. Prerequisites
load ’libs.ijs’
load ’stats.ijs’
fdist_z_ =: [: +/"1 =/
Fdist_z_ =: [: +/"1 >/
pdf_z_ =: fdist@%[:#]
phasediag_z_ =: }: ,: }.
cocurrent <’EB’
s =: rhs0
x =: >@lhs1
p =: >@lhs2
A.4 Scripts from Chapter 6 195
f1 =: ˆ@(s */ x)
f2 =: f1 (*"1) p
f3 =: +/"1 @f2
f4 =: (ˆ.@f3) % s
cocurrent <’base’
eb_z_ =: f4_EB_
NB. Prerequisites
load ’libs.ijs’
diff_z_ =: 4 : 0
’v0 N a’ =. x. [ ’x0’ =. rhs1 y.
’xn1 xn2’ =. a gˆ:(N) x0, (x0+v0)
xn1, | xn1-xn2
)
lyap_z_ =: 4 : 0
’v0 N a R’ =. x. [ ’x0’ =. y.
df =: rhs2"1 ((v0,N,a) diffˆ:(1 to R) x0)
(ln df%v0)%N
)
doall_z_ =: 3 : 0
L =: ’’
for_a. y.
do.
l =. mean (1e_6,20,a,100) lyap 0.1
L =. L,l
end.
L
)
f1 =: u*x
f2 =: u*(>:@-@x)
select =: 0.5 &le@x
xnext =: f1 ‘ f2 @. select
cocurrent < ’base’
tmap_z_ =: xnext_TENTMAP_
f1 =: x%d
f2 =: (x-d)%(1:-d)
xnext =: f1 ‘ f2 @. (d<x)
NB. xnext =: (f1*I0) + (f2*I1)
cocurrent < ’base’
bshift_z_ =: xnext_BMAP_
c1 =: (>:@-@e1 - d) % d ˆ m
c2 =: -@(e2 - d) % >:@-@d ˆ m
select =: d<x
f1 =: e1 + x + c1 * x ˆ m
f2 =: -@e2 + x - c2 * >:@-@x ˆ m
I0 =: x le d
I1 =: d < x
xnext =: f1 ‘ f2 @. (d<x)
NB. xnext =: (I0*f1) + (I1*f2)
cmap =: xnext
198 A Scripts
dimap =: xnext_DIMAP_
NB. Prerequisites
load ’libs.ijs’
Ls =: lhs3
Lp =: lhs4
ta =: >@rhs1 NB. list of arrival times
clist =: >@rhs2 NB. conformance vector
ta1 =: {.@ta NB. 1st element of ta list
tn =: }.@ta NB. tail of ta list
cocurrent < ’base’
f1 =: tn_GCRA_;(clist_GCRA_,0:);g2
f2 =: tn_GCRA_;(clist_GCRA_,1:);TAT
f3 =: f1 ‘ f2 @. conform
cocurrent < ’z’
vsa_z_ =: f3_VSA_
g1 =: TATs - Ls_GCRA_
g2 =: TATp - Lp_GCRA_
g3 =: min @ (g1,g2)
conform =: ta1_GCRA_ < g3
TATsnext =: max @ (ta1_GCRA_, TATs) + Is_GCRA_
TATpnext =: max @ (ta1_GCRA_, TATp) + Ip_GCRA_
f1 =: tn_GCRA_;(clist_GCRA_,0:);TATsnext;TATpnext
f2 =: tn_GCRA_;(clist_GCRA_,1:);TATs;TATp
f3 =: f1 ‘ f2 @. conform
cocurrent < ’base’
NB.dualvsa_z_ =: f1_DVSA_ ‘ f2_DVSA_ @. conform_DVSA_
dvsa_z_ =: f3_DVSA_
g1 =: B - (ta1_GCRA_ - LCT)
g2 =: max0@g1 + I_GCRA_
f1 =: tn_GCRA_;(clist_GCRA_,0:);ta1_GCRA_;g2
f2 =: tn_GCRA_;(clist_GCRA_,1:);LCT;B
conform =: g1 > L_GCRA_
f3 =: f1 ‘ f2 @. conform
cocurrent < ’base’
lb_z_ =: f3_LB_
g1 =: -/@ (Bs,ta1_GCRA_,LCT)
g2 =: -/@ (Bp,ta1_GCRA_,LCT)
NB.g1 =: Bs - (ta1_GCRA_-LCT)
NB.g2 =: Bp - (ta1_GCRA_-LCT)
g3 =: max0@g1 + Is_GCRA_
g4 =: max0@g2 + Ip_GCRA_
conform =: (g1 > Ls_GCRA_) +. g2 > Lp_GCRA_
f1 =: tn_GCRA_;(clist_GCRA_,0:);ta1_GCRA_;g3;g4
f2 =: tn_GCRA_;(clist_GCRA_,1:);LCT;Bs;Bp
f3 =: f1 ‘ f2 @. conform
cocurrent < ’base’
duallb_z_ =: f1_DLB_ ‘ f2_DLB_ @. conform_DLB_
dlb_z_ =: f3_DLB_
cocurrent < ’base’
NB. Prerequisites
load ’libs.ijs’
t =: >@rhs1
w =: >@rhs2
q =: >@rhs3
ack =: >@rhs4
tx =: >@rhs5
txnext =: w%RTT
a =: +/@txnext NB. aggregate flow
202 A Scripts
wi =: ceil@(w + alpha % w ˆ k)
wd =: ceil@(w - beta * w ˆ l)
h1 =: (w * Inak) + wi * Iack
h2 =: (w * Inak) + wd * Iack
h3 =: (h1 * Incon) + h2 * Icon
cocurrent <’base’
tcpf_z_ =: h4_TCPC_
cocurrent <’TCP’
flow =: lhs6
ssthresh =: >@rhs6
k =: -@(w_TCPC_ le ssthresh)
wi =: ceil@(w_TCPC_ + alpha_TCPC_ % w_TCPC_ ˆ k)
wd =: 1:
g1 =: ceil@-:@ w_TCPC_
g2 =: max1@g1
g3 =: (ssthresh * Inak_TCPC_) + (g2 * Iack_TCPC_)
ssthnext =: (ssthresh * Incon_TCPC_) + (g3 * Icon_TCPC_)
h4 =: (flow%RTT_TCPC_) ,: txnext_TCPC_
txnext =: min"2@h4 NB. apply minimum cwnd
A.7 Scripts from Chapter 9 203
cocurrent <’base’
tcp_z_ =: h7_TCP_
Abbreviations
1. R Adler, Raisa Feldman, and Murad Taqqu. A Practical Guide to Heavy Tails. Birkhäuser,
Boston, 1998. 5.1
2. V Alwayn. Advanced MPLS Design and Implementation. Cisco Press, Indianapolis,
2002. 1.3
3. D Bansal and H Balakrishman. Binomial congestion control algorithms. IEEE INFO-
COM 2001, 2001. 9.2
4. J S Bendat and A G Piersol. Random Data Analysis and Measurement Procedures. John
Wiley and Sons, New York, 1986.
5. J Beran. Statistics for Long-Memory Processes. Chapman and Hall, New York, 1994.
6. J Beran, R Sherman, M S Taqqu, and W Willinger. Long-range dependence in variable-
bit-rate video traffic. IEEE/ACM Transactions on Communications, 43(2/3/4), 1995. 1,
1.2, 5, 6
7. D. R. Boggs, J. C. Mogul, and C. A. Kent. Measured capacity of an ethernet: myths and
reality. In SIGCOMM ’88: Symposium proceedings on Communications architectures
and protocols, pages 222–234, New York, 1988. ACM Press. 1.2
8. G Box, W Hunter, and J Hunter. Statistics for Experimenters. Wiley and Sons, New York,
1978.
9. V G Cerf. U.S. Senate Committee on Commerce, science, and Transportation hearing on
“Network Neutrality”, 9 2006. http://commerce.senate.gov/pdf/cerf-020706.pdf. 1.1
10. Cheng-Shang Chang. Performance Guarantees in Communication Networks. Springer,
New York, 2000. 4.3.6, 4.4, 5.4
11. D Chiu and R Jain. Analysis of the increase and decrease algorithms for congestion
avoidance in computer networks. Computer Networks and ISDN Systems, 17:1–14, 1989.
12. D Comer. Internetworking With TCP/IP Volume 1: Principles Protocols, and Architec-
ture. Prentice Hall, Englewood CLiffs, NJ, 5 edition, 2006. 1.1, 1.3
13. M E Corvella and A Bestavros. Self-similarity in world wide web traffic: Evidence and
possible causes. IEEE/ACM Transactions on Networking, 5(6), 12 1997. 1, 1.2, 6
14. L G Cuthbert and J C Sapanel. ATM the Broadband Telecommunications Solution. The
Institution of Electrical Engineers, London, 1996.
15. P E and Makoto Maejima. Self-similar Processes. Princeton, New Jersey, 2002.
16. A Erramilli, O Narayan, and W Willinger. Experimental queueing analysis with long-
range dependent packet traffic. IEEE/ACM Transactions Networking, 4(2):209–223,
1996. 1, 1.2, 5
208 References
17. A Erramilli, R Singh, and P. Pruthi. Modeling packet traffic with chaotic maps, 7 1994.
Royal Institute of Technology, ISRN KTH/IT/R-94/18–SE, Stockholm-Kista, Sweden.
7.1, 7.2
18. J Evers. Spammers now own email’s dirty reputation, 2006. http://www.silicon.com
/research/specialreports/thespamreport/0,39025001,39160781,00.htm. 1.1
19. T Ferrari, T Chown, N Simar, R Sabatino, S Venaas, and S Leinen. Experiments with
less than best effort (LBE) Quality of Service, 08 2002. http://www.dante.net/tf-ngn/
D9.9-lbe.pdf. 1.1
20. Sally Floyd and Van Jacobson. Random early detection gateways for congestion avoid-
ance. IEEE/ACM Transations on Networking, 1(4):397–413, 8 1993. 1.3
21. J E Gentle. Random Number Generation and Monte Carlo Methods. Springer, New York,
1998.
22. N Giroux and S Ganti. Quality of Service in ATM Networks. Prentice Hall, Englewood
Cliffs, NJ, 1999. 1.1
23. A Gupta, D O Stahl, and A B Whinston. The economics of network management. Com-
munications of the ACM, 42(9), 9 1999. 1.1
24. M Handley, S Floyd, J Padhye, and J Widmer. TCP friendly rate control (TFRC): Protocol
specification. 1 2003. 9
25. Y Hayel, D Ros, and B Tuffin. Less-than-best-effort services, pricing and scheduling. In
INFOCOMM 2004, Albuquerque, 2004. 1.1
26. C W Helstrom. Probability and Stochastic Processes for Engineers. Macmillan, New
York, 2nd edition, 1984. 6.2, 6.2
27. A Holt. Improving the Performance of Wide Area Networks. PhD thesis, The Open
University, 1999.
28. A Holt. Long-range dependence and self-similarity in world-wide web proxy cache ref-
erences. IEE Proceeding Communications, 147(6):317–321, 2000. 1, 1.2
29. Van Jacobson. Congestion avoidance and control. Proc ACM SIGCOMM, pages 314–329,
8 1988. 1, 9
30. S Jin, G Liang, I Matta, and A Bestavros. A spectrum of TCP-friendly window-based
congestion control algorithms. IEEE/ACM Transaction on Networking, 11(3):341–355, 6
2003. 9.2
31. F Kelly. Effective bandwidths at multi-class queues. Queuing Systems, 28:5–16, 1992.
6.4
32. M Kendall and J K Ord. Time Series. Edward Arnold, London, 3rd edition, 1990.
33. L Kleinrock. Queuing Systems. John Wiley and Sons, New York, 1975. 4
34. E Kohler, M Handley, and S Floyd. Designing DCCP: Congestion control without relia-
bility, 2003. http://citeseer.ist.psu.edu/kohler03designing.html. 1
35. D Kouvatos. Performance Evaluation and Application of ATM Networks. Kluwer Acad-
emic Publishers, London, 2000.
36. Jean-Yves le Boudec and Patrick Thiran. Network Calculus: A Theory of Deterministic
Queuing Systems of the Internet. Springer, New York, 2001. 4.3.6, 4.6
37. W E Leland, M S Taqqu, W Willinger, and D Wilson. On the self-similar nature of
ethernet traffic. IEEE/ACM Transactions on Networking, 2(1), 2 1994. 1, 6
38. J Li, A Wolisz, and R Popescu-Zeletin. Modelling and simulation of fractional ARIMA
processes based on importance sampling. In SAC ’98: Proceedings of the 1998 ACM
Symposium on Applied Computing, pages 453–455, New York, 1998. ACM Press. 5.3.3
39. D Lindley. The theory of queues with a single server. Proc. Camb. Phil. Soc.,
48(1052):277–289, 1952. 1.4, 4.4, 5.4, 9.2
40. M Loukides. System Performance Testing. O’Reilly and & Associates, Sepastopol, Cali-
fornia, 1991.
References 209
41. Paul A Lynn and Wolfgang Fuerst. Introductory Digital Signal Processing with Computer
Applications. John Wiley & Sons, New York, USA, 1994. 3
42. G Maedel. Mathematics for Radio and Communication, Book II Trigonometry, Alegbra,
Complex Numbers with Answers. Maedel Publishing House, New York, 1939.
43. S Makridakis, S Wheelwright, and R Hyndman. Forecasting Methods and Applications.
John Wiley and Sons, New York, 3rd edition, 1998.
44. M G Marsh. Policy Routing using Linux. Sams, USA, 2001. 1.3
45. D McDysan and D Spohn. ATM Theory and Applications. McGraw-Hill, New York,
1999.
46. L W McKnight and J P Bailey. Internet ecomomics: When constituencies collide in
cyberspace. IEEE Internet Computing, 6(1):30–37, 11 1997. 1.1
47. R M Metcalfe and D R Boggs. Ethernet: Distributed packet switching for local computer
networks. Communications of the ACM, 19(5):395–404, 7 1976. 1.2
48. W B Norton. Internet service providers and peering. In Proceedings of NANOG 19,
Albuquerque, New Mexico, June 2000. 1.1
49. W B Norton. Art of peering: The peering playbook, 2006. http://arneill-py.sacramento
.ca.us/ipv6mh/playbook.pdf. 1.1
50. Consumers’ Institute of New Zealand. Internet neutrality? http://www.consumer.org.nz/
newsitem.asp?docid=2624&category=News&topic=ISPs\able\to\slow\down\VoIP\
services, 6 2006. 1.1
51. D Passmore. Ethernet: Not just for LANs anymore, 07 2000. http://www.burtongroup.
com/promo/columns/column.asp?articleid=80&employeeid=56. 1.2
52. H Peitgen, H Jurgens, D Saupe, E Maletsky, T Pericante, and L Yunker. Fractals for the
Classroom, Part One. Springer-Verlag, New York, 1992. 5.1, 7.1
53. J M Pitts and J A Schormans. Introduction to IP and ATM Design and Performance. John
Wiley and Sons, Chichester, 1996.
54. W Press, W Vettering, S Taukolsky, and B Flannery. Numerical Recipes in C. Cambridge
Press, Cambridge, 2002. 5.1
55. P Pruthi and A Erramilli. Heavy-tailed on/off source behavior and self-similarity. vol-
ume 1, pages 445–450, 6 1995. 6.5
56. K Ramakrishnan and R Jain. A binary feedback scheme for congestion avoidance in
computer networks. ACM, Transaction on Computer Systems, 8(2):158–181, 5 1990. 9.2
57. H Rich. J for C programmers. http://www.jsoftware.com/jwiki/Doc/Books, 10 2004.
58. R Y Rubinstein. Simulation and the Monte Carlo Methods. John Wiley and Sons, New
York, 1981.
59. Lionel Salem, Frederic, and Coralie Salam. The Most Beautiful Mathematical Formulas.
John Wiley & Sons, New York, USA, 1992. 3.2.3
60. Christian Sandvig. Network neutrality is the new common carrier. The Journal of Policy,
Regulation, and Strategy, 7 2006. 1.1
61. M Schuyler. Measuring network traffic, 2001. http://www.solarwinds.net/Awards/
View.htm. 1.2
62. Claude E Shannon and Warren Weaver. The Mathematical Theory of Communication.
University of Illinois Press, Chicago, USA, 1963. 3.2.2, 3.2.4
63. R Sircant. The Mathematics of Internet Congestion Control. Birkhauser, Boston, 2004.
9.1, 9.3
64. W R Stevens. TCP/IP Illustrated Volume 1, The Protocols. Addison-Wesley, Boston,
1994.
65. C Stoll. The Cukcoo’s Egg. Bodley Head, UK, 1989. 1.1
66. A S Tanenbaum. Computer Networks. Prentice-Hall, Englewood Cliffs, NJ, 1989. 1.2
210 References
67. R Taylor. The great firewall of China. BBC News, 6 2006. http://news.bbc.co.uk/2/hi/
programmes/click online/4587622.stm. 1.1
68. D Teare. CCDA Self Study: Designing for Cisco Internetwork Solutions. Ciscopress,
2003. 1.2, 1.3
69. T M Thomas. OSPF Network Design Solution. Ciscopress, Indianapolis, 1998. 1.3
70. N Thomson. J for engineers and computing professionals. IEE Computing & Control
Engineering Journal, 12(5):212–216, 10 2001.
71. N Thomson. J: The Natural Language for Analytical Computing. Research Studies Press,
Baldock Hertfordshire, 2001. 5.1
72. T. Tuan and K. Park. Congestion control for self-similar network traffic. Technical Report
CSD-TR-98014, 1998.
73. S Vegesna. IP Quality of Service. Ciscopress, Indianapolis, 2001. 1.1, 1.3
74. M Ward. More than 95% of e-mail is junk, 2006. http://news.bbc.co.uk/2/hi/technology
/5219554.stm. 1.1
75. K Xu and N Ansari. Stability and fairness of rate estimation-based AIAD congestion
control in TCP. IEEE Communications Letters, 9(4):378–380, 4 2004. 9
Index