04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

example in the previous paragraph, it’s okay that we don’t move all n arriving<br />

packets to a common output buffer in one time step; we can afford more time<br />

for this, since their departures on this common output link will be spread out<br />

over a long period of time anyway.)<br />

/-~ <strong>Design</strong>ing the <strong>Algorithm</strong><br />

Just to be precise, here’s our model for a speed-up of 2.<br />

One step under sped-up input/output queueing:<br />

Packets ~rrive on input links and ~re placed in input buffers<br />

A set of packets whose types form a matching are moved to their<br />

associated output buffers<br />

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

A set of packets whose types form a matching are moved to their<br />

associated output buffers<br />

In order to prove that this model can simulate pure output queueing; we ,<br />

need to resolve the crucial underspecified point in the model above: Which<br />

matchings should be moved in each step? The answer to this question will form<br />

the core of the result, and we build up to it through a sequence of intermediate.<br />

steps. To begin with, we make one simple observation right away: If a packet<br />

of type (I, O) is part of a matching selected by the switch, then the switch wil!<br />

move the packet of this type that has the earliest time to leave.<br />

Maintaining Input and Output Buffers To decide which two matchings the<br />

switch should move in a given time step, we define some quantifies that track<br />

the current state of the switch relative to pure output queueing. To begin with,<br />

for a packet p, we define its time to leave, TL(p), to be the time step in which<br />

it would depart on its output link from a switch that was running pure output<br />

queueing. The goal is to make sure that each packet p departs from our switch<br />

(running sped-up input/output queueing) in precisq!y the time step TL(p).<br />

Conceptually, each input buffer is maintained as an ordered list; however,<br />

we retain the freedom to insert an arriving packet into the middle of this<br />

order, and to move a packet to its output buffer even when it is not yet at<br />

the front of the line. Despite this, the linear ordering of the buffer will form<br />

a useful progress measure. Each output buffer, by contrast, does not need to<br />

be ordered; when a packer’s time to leave comes up, we simply let it depart.<br />

We can think of the whole setup as resembling a busy airport terminal, with<br />

the input buffers corresponding to check-in counters, the output buffers to<br />

the departure lounge, and the internals of the switch to a congested security<br />

checkpoint. The input buffers are stressful places: If you don’t make it to the<br />

head of the line by the time your departure is announced, you could miss your<br />

time to leave; to mitigate this, there are airport personnel who are allowed<br />

to helpfully extract you from the middle of the line and hustle you through<br />

security. The output buffers, by way of contrast, are relaxing places: You sit<br />

around until your time to leave is announced, and then you just go. The goal<br />

is to get everyone through the congestion in the middle so that they depart on<br />

time.<br />

One consequence of these observations is that we don’t need to worry<br />

about packets that are already in output buffers; they’ll just depart at the<br />

fight time. Hence we refer to a packet p as unprocessed if it is still in its<br />

input buffer, and we define some further useful quantities for such packets.<br />

The input cushion IC(p) is the number of packets ordered in front of p in its<br />

input buffer. The output cushion OC(p) is the number of packets already in<br />

p’s output buffer that have an earlier time to leave. Things are going well for<br />

an unprocessed packet p if OC(p) is significantly greater than IC(p); in this<br />

case, p is near the front of the line in its input buffer, and there are still a lot of<br />

packets before it in the output buffer. To capture this relationship, we define<br />

Slack(p) --= OC(p) - IC(p), observing that large values of Slack(p) are good.<br />

Here is our plan: We will move matchings through the switch so as to<br />

maintain the following two properties at all times.<br />

(i) Slack(p) >_ 0 for all unprocessed packets p.<br />

(ii) In any step that begins with IC(p) = OC(p) = 0, packet p will be moved<br />

to its output buffer in the first matching.<br />

We first claim that it is sufficient to maintain these two properties.<br />

(E.1) I[properties (i) and (ii) are maintained [or all unprocessed packets at<br />

all times, then every packet p will depart at its time to leave TL(p).<br />

Proof. Ifp is in its output buffer at the start of step TL(p), then it can clearly<br />

depart. Otherwise it must be in its input buffer. In this case, we have OC(p) = 0<br />

at the start of the step. By property (i), we have Slack(p) = OC(p) - IC(p) >_ O,<br />

and hence IC(p) = 0. It then follows from property (ii) that p will be moved to<br />

the output buffer in the first matching of this step, and hence will depart in<br />

this step as well. ~,<br />

It turns out that property (ii) is easy to guarantee (and i~ will arise naturally<br />

from the solution below), so we focus on the tricky task of choosing matchings<br />

so as to maintain property (i).<br />

Moving a Matching through a Switch When a packet p first arrives on an<br />

input link, we insert it as far back in the input buffer as possible (potentially<br />

somewhere in the middle) consistent with the requirement Slack(p) > O. This<br />

makes sure property (i) is satisfied initially for p.<br />

801

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

Saved successfully!

Ooh no, something went wrong!