04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

796<br />

Epilogue: <strong>Algorithm</strong>s That Run Forever<br />

There are many settings in which we could explore this theme, and as our<br />

final topic for the book we consider one of the most compelling: the design of<br />

algorithms for high-speed packet switching on the Internet.<br />

~ The Problem<br />

A packet traveling from a source to a destination on the Internet can be thought<br />

of as traversing a path in a large graph whose nodes are switches and whose<br />

edges are the cables that link switches together. Each packet p has a header<br />

from which a switch can determine, when p arrives on an input lJ_nk, the output<br />

link on which p needs to depart. The goal of a switch is thus to take streams of<br />

packets arriving on its input links and move each packet, as quickly as possible,<br />

to the particular output link on which it needs to depart. How quickly? In highvolume<br />

settings, it is possible for a packet to arrive on each input link once<br />

ever~ few tens of nanoseconds; if they aren’t offloaded to their respective<br />

output links at a comparable rate, then traffic wil! back up and packets wil!<br />

be dropped.<br />

In order to think about the algorithms operating inside a switch, we model ’<br />

the switch itself as follows. It has n input links I1 ..... In and n output links<br />

On. Packets arrive on the input links; a given packet p has an associated<br />

input/output type (I[p], O[p]) indicating that it has arrived at input link I[p]<br />

and needs to depart on output link O[p]. Time moves in discrete steps; in each<br />

step, at most one new packet arrives on each input link, and at most one<br />

packet can depart on each output link.<br />

Consider the example in Figure E.1. In a single time step, the three packets<br />

p, q, and r have arrived at an empty switch on input links I1, 13, and I4,<br />

respectively. Packet p is destined for 01, packet q is destined for 03, and packet<br />

r is also destined for 03. Now there’s no problem sending packet p out on link<br />

O1; but only one packet can depart on link 03, and so the switch has to resolve<br />

the contention between q and r. How can it do this?<br />

The simplest model of switch behavior is known as pure output queueing,<br />

and it’s essentially an idealized picture of how we wished a switch behaved.<br />

In this model, all nodes that arrive in a given time step are placed in an output<br />

buffer associated with their output link, and one of the packets in each output<br />

buffer actually gets to depart. More concretely, here’s the model of a single<br />

time step.<br />

One step trader pure output queueing:<br />

Packets arrive on input links<br />

Each packet p of type (I~], 0~]) is moved to output buffer 0~]<br />

At most one packet departs from each output buffer<br />

Epilogue: <strong>Algorithm</strong>s That Run Forever<br />

_____------ 0 2<br />

Figure E.1 A switch with n = 4 inputS and outputs. In one time step, packets p, q, and r<br />

have arrived.<br />

So, in Figure E. 1, the given time step could end with packets p and q having<br />

departed on their output links, and with packet r sitting in the output buffer<br />

03. (In discussing this example here and below, we’ll assume that q is favored<br />

over r when decisions are made.) Under this model, the switch is basically<br />

a "fricfionless" object through which packets pass unimpeded to their output<br />

buffer.<br />

In reality, however, a packet that arrives on an input link must be copied<br />

over to its appropriate output link, and this operation requires some processing<br />

that ties up both the input and output links for a few nanoseconds. So, rea!ly,<br />

constraints within the switch do pose some obstacles to the movement of<br />

packets from inputs to outputs.<br />

The most restrictive model of these constraints, input/output queueing,<br />

works as follows. We now have an input buffer for each input link I, as<br />

well as an output buffer for each output link O. When each packet arrives, it<br />

immediately lands in its associated input buffer. In a single time step, a switch<br />

can read at most one packet from each input buffer and write at most one<br />

packet to each output buffer. So under input/output queueing, the example of<br />

Figure E.1 would work as follows. Each of p, q, and r would arrive in different<br />

input buffers; the switch could then move p and q to their output buffers, but<br />

it could not move all three, since moving al! three would involve writing two<br />

packets into the output buffer 03. Thus the first step would end with p and<br />

q having departed on their output links, and r sitting in the input buffer 14<br />

(rather than in the output buffer 03).<br />

More generally, the restriction of limited reading and writing amounts to<br />

the following: If packets Pl ..... p~ are moved in a single time step from input<br />

797

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!