Appendix: a proof of tightness
In this appendix, we set out to prove Theorem
7 in more detail. In other words, we prove conditions for tightness of the relative worst-case response-time bound given in Theorem
6. This is done by showing that for any margin
\(\epsilon > 0\) there exists an execution
\(u^\epsilon \) in which some frame in
M is delayed by more than
$$\begin{aligned} \begin{aligned} C^\mathrm {max}_{\mathbb {L}}\cdot \left( 1+ \frac{\alpha _{\mathbb {H}}^+}{\alpha _{\mathbb {H}}^-}\right) - \frac{ CR _{\mathbb {H}}^{min}}{\alpha _{\mathbb {H}}^-} - \epsilon . \end{aligned} \end{aligned}$$
compared to its un-interfered schedule
\(u^\epsilon _0\). The construction of this execution
\(u^\epsilon \) consists of five parts, illustrated in Fig.
10, and is worked-out using a series of lemmas, addressing the different phases in isolation. Incidentally, this construction also serves as a proof-sketch that the axioms we assumed to describe the operation of credit-based shaping are not self-contradictory.
Throughout this appendix, we consider a given stream of priority class \(M \in {\mathbb {P}}\). We use \({\mathbb {H}} = \{ X \in {\mathbb {P}} \mid X > M \}\) to denote all streams of higher priority and \({\mathbb {L}} = \{ X \in {\mathbb {P}} \mid X < M \}\) to denote all streams of lower priority. Furthermore, we always assume that M and \({\mathbb {H}}\) are under credit based shaping, and \(\alpha _{{\mathbb {H}}}^+ + \alpha _{M}^+ \le BW\). Finally, we assume an arbitrarily small value \(\epsilon > 0\), by which we strive to approximate the worst-case response time. We construct \(u^\epsilon \) by defining at which point in time, which events occur in which order.
Lower priority interference (phase 1) Construct an execution
\(u^\epsilon \) such that at time
\(t_0 = 0\) a lower priority frame
\(l \in {\mathbb {L}}\) of maximum size
\(C^{u^\epsilon }(l) = C_{\mathbb {L}}^\mathrm {max}\) arrives, immediately followed by the arrival of a frame
\(m \in {\mathbb {M}}\) and a burst
B of higher priority frames, such that for each
\(H \in {\mathbb {H}}\) there is an
\(h \in B\) with
\(h \in H\). Then, at time
\(t_1 = C_{\mathbb {L}}^\mathrm {max}\), only the lower priority frame
l has transmitted, and the credit of all
\(X \in M \cup {\mathbb {H}}\) will be given by:
$$\begin{aligned} CR ^{u^\epsilon }_X(t_1) = \alpha _X^+ \cdot C_{\mathbb {L}}^\mathrm {max} \end{aligned}$$
and the cumulative credit of all higher-priority shapers is given by
$$\begin{aligned} CR ^{u^\epsilon }_{\mathbb {H}}(t_1) = \alpha _{\mathbb {H}}^+ \cdot C_{\mathbb {L}}^\mathrm {max} \end{aligned}$$
Depletion (phase 2) Next, assuming the burst
B is large enough, observe that at time
$$\begin{aligned} t_2 = t_1 + \frac{\alpha ^+_{\mathbb {H}}}{\alpha ^-_{\mathbb {H}}} C^\mathrm {max}_{\mathbb {L}} \end{aligned}$$
we find that the cumulative credit has decreased to zero, i.e.
$$\begin{aligned} CR ^{u^\epsilon }_{\mathbb {H}}(t_2) = 0. \end{aligned}$$
The reason for this, is that given that cumulative credit of higher priority shapers is non-negative, and given sufficient pending load, at least one higher priority shaper has both non-negative credit and pending load and is therefore eligible for transmission. As a consequence, higher priority transmissions will continue at least until cumulative credit drops below 0.
Now, if we consider a burst
B that consists of frames that all have size smaller than
\(\delta > 0\). Then for each higher priority shaper
\(H \in {\mathbb {H}}\) we find:
$$\begin{aligned} -\,\alpha _H^- \delta \le CR ^{u^\epsilon }_H(t_2) \le \sum _{X \in {\mathbb {H}}} \alpha _X^- \delta \end{aligned}$$
Furthermore, because cumulative credit is 0 at
\(t_2\), there exists some higher priority shaper
Y with
\( CR ^{u^\epsilon }_Y(t_2) \ge 0\).
Reset (phase 3) Next, we adapt the burst
B a bit. We remove all frames from
B that would transmit after
\(t_2\), and add a frame of size
\(\eta _H = \frac{ CR ^{u^\epsilon }_H(t_2)}{\alpha _H^-}\) for every priority class
\(H \in {\mathbb {H}}\) that has positive credit at time
\(t_2\). This will not change the execution upto time
\(t_2\), but ensures that time
\(t_3\), taken to be the finishing time of the last
\(\eta _H\) frame in the burst, satisfies
$$\begin{aligned} t_2 \le t_3 \le t_2 + \sum _{Y \in {\mathbb {H}}, CR ^{u^\epsilon }_Y(t_2) \ge 0} \frac{\sum _{X \in {\mathbb {H}}} \alpha _X^- \cdot \delta }{\alpha _Y^-} \end{aligned}$$
At
\(t_3\) there is now no more pending load from higher priority frames. Furthermore, all priority classes
\(H \in {\mathbb {H}}\) satisfy
$$\begin{aligned} -\,\alpha _H^- \cdot \delta \le CR ^{u^\epsilon }_H(t_3) \le 0 \end{aligned}$$
because the size of
\(\eta _H\) ensures that there is a reset of credit due to lack of pending load at the end of each transmission. Note that for one priority class
\(Y \in {\mathbb {H}}\), namely the
\(\eta _Y\) transmission that occurs first, credit actually reaches 0 without a reset, because the size of
\(\eta _Y\) is chosen to exactly deplete credit.
Connection (phase 4) In the fourth phase, we try to make a connection to the fifth phase, which requires a little look-ahead. The challenge in the fifth phase is that at its start, all credits except one have a particular negative value. The fourth phase intends to create this starting credit.
So, consider a function
\(f : {\mathbb {H}} \rightarrow {\mathbb {R}}^+\) and a value
\(\zeta > 0\). Observe that we can then create a sequence of higher priority classes
\(H_1 \ldots H_N\) in which each priority class of
\({\mathbb {H}}\) occurs exactly once and
\(H_1 = Y\) represents the priority classes
Y that reaches a credit of 0 by depleting it exactly to 0. I.e.
\(\eta _Y\) is the first of the
\(\eta \) frames to transmit in phase 3. Subsequently, construct a sequence
\(\sigma _i\) such that:
$$\begin{aligned} \sigma _i = \frac{-f(H_i) \cdot \zeta + \alpha _{H_i}^+ \cdot \sum _{i < j \le N} \sigma _j}{\alpha _{H_i}^-} \end{aligned}$$
and extend the execution
\(u^\epsilon \) with an arrival of a frame of priority
\(H_i\) and size
\(\sigma _i\) at (or just before) time
$$\begin{aligned} t^i_4 = t_3 + \sum _{1 \le j < i} \sigma _i. \end{aligned}$$
Then, at time
\(t_4 = t^N_4\) we find by construction:
$$\begin{aligned} CR ^{u^\epsilon }_{H_i}(t_4) = - f(H_i) \cdot \zeta \end{aligned}$$
assuming
\(\zeta \) is chosen sufficiently small, and
\(\delta \) is chosen much smaller than
\(\zeta \).
To see why this construction works, notice that at \(t_3\) we find that Y is eligible. It has just received a pending load of \(\sigma _1\) and is able to transmit. Furthermore, its previous transmission reaches 0 credit (instead of resulting in a reset), so the arrival of \(\sigma _1\) does not change the evolution of credit constructed in phase 3. The frame \(\sigma _1\) from Y will transmit, and after transmission, by construction, will be recovering until time \(t_4\), reaching the intended credit. After Y has transmitted, all other shapers that had negative credit will have recovered, assuming that the value of \(\delta \) is sufficiently small. Their credit will remain 0 because none of those shapers have pending load. At the end of the transmission of Y, the next shaper in the sequence \(H_1 \ldots H_N\) will obtain pending load and transmit. By construction, this transmission is chosen such that the desired credit at \(t_4\) is obtained. Naturally, for this construction to be legal, \(\zeta \) must be chosen small enough to ensure none of the required frames exceeds the maximum frame size. In the construction of the final scenario, we therefore must determine \(\zeta \) before determining \(\delta \).
Slow descend (phase 5) The fifth phase is aimed at maintaining a slow descend while aiming at a lowest possible value of cumulative credit in the end. We know from Corollary
2 that a slowest descend is attained if all credits are recovering except for the one that is transmitting. In order to get a credit that is as low as possible, we reason backwards, starting at the end of the scenario. We are attempting to create a worst-case scenario, where at its end (time
\(t_5\)) the transmission of the medium priority frame starts. We therefore know that at
\(t_5\) credit of all higher-priority shapers is negative, otherwise another higher-priority interference would have been possible.
Now, assume shaper H performed the last transmission, ending at \(t_5\), then at the start of H, credit of all other shapers must have been lower than at \(t_5\), because all those shapers are in recovery. We need the execution we are constructing to be a valid credit-based schedule. Therefore, we must take care that the credits of individual shapers do not drop below their minimum values (i.e. \(-\,\alpha _H^- \cdot C_H^\mathrm {max}\)). In the construction of this phase, we start at the end, and prefix smaller and smaller frames, aiming to avoid such credit violations. We know that cumulative credit will always be decreasing throughout a valid execution, and aim to carry out this decrease for as long as possible. In the final paragraph of this appendix we study under which conditions the construction in phase 5 actually attains minimum credit.
Since we intend to prefix smaller and smaller frame sizes until they are arbitrarily small (of magnitude
\(\zeta \) as aimed at in the previous phase), we need some way to construct an infinite sequence. This we do by iterating over a sequence
\(H_1 \ldots H_N\) in which each higher priority class occurs once. Unlike in the previous phase, this sequence does not have a designated first priority class, but instead it should satisfy:
$$\begin{aligned} \frac{C_{H_i}^\mathrm {max}}{\alpha _{H_1}^+} \ge \frac{C_{H_{i+1}}^\mathrm {max}}{\alpha _{H_{i+1}}^+} \end{aligned}$$
for all
\(1 \le i < N\). Note that such a sequence can always be constructed, simply by ordering the priorities in
\({\mathbb {H}}\) according to the ratio between maximum frame size and recovery rate.
A second observation, if we are to build a worst-case execution, is that the last transmission should have maximum frame size. If it does not, a larger delay would have been possible, resulting in a worse case. Therefore, the last transmission before
\(t_5\) will have a maximum frame size. Given the sequence
\(H_1 \ldots H_N\), we define:
$$\begin{aligned} \sigma _N^0 = C_{H_N}^\mathrm {max} \end{aligned}$$
Subsequently, the one-but-last transmission
\(H_{N-1}\) needs to fit three requirements. Firstly, it should be maximal size if possible. Secondly, if it is chosen too large, credit of
\(H_N\) may drop below its individual minimum. And thirdly, it should be a strictly positive value. To guarantee that it is a strictly positive value, we assume a margin
\(\mu > 0\) which can be taken arbitrarily small, and obtain
$$\begin{aligned} \sigma _{N-1}^0 = \min \left\{ C_{H_{N-1}}^\mathrm {max},\ \frac{\alpha _{H_N}^-}{\alpha _{H_N}^+} \big (C_N^\mathrm {max} - \mu \big ) \right\} \end{aligned}$$
For an arbitrary transmission in the first sequence
\(H_1 \ldots H_N\), we need to verify that all shapers that transmit later do not drop below their minimum value. Iterating the previous construction over the entire sequence
\(H_1 \ldots H_N\) we find:
$$\begin{aligned} \sigma _i^0 = \min \left\{ C_{H_i}^\mathrm {max} ,\ \inf _{i< k \le N} \frac{\alpha _{H_k}^-}{\alpha _{H_k}^+} \big (C_{H_k}^\mathrm {max} - \mu \big ) - \sum _{i< j < k} \sigma _j^0 \right\} \end{aligned}$$
The values
\(\sigma _i^0\) now represent the sizes of the last transmissions in phase 5 in Fig.
10. The transmissions that are prefixed are determined completely by the requirement that they recover exactly at the start-times of the next frame. So, reasoning backwards along the execution we find:
$$\begin{aligned} \sigma _i^{k+1} = \frac{\alpha _{H_i}^+}{\alpha _{H_i}^-} \left( \sum _{1 \le j< i} \sigma _j^k + \sum _{i < j \le N} \sigma _j^{k+1} \right) \end{aligned}$$
With the arrival times of the frames simply given by
$$\begin{aligned} t_i^k = t_5 - \left( \sum _{i \le j \le N} \sigma _j^k \right) - \left( \sum _{1 \le j \le N} \sum _{l < k} \sigma _j^l \right) \end{aligned}$$
It is clear by construction that for each of the priority classes
\(H_1\) the time of recovery of the previous transmission coincides with the transmission of the next frame by that priority class. To guarantee that the sequence leads to a valid scenario, we therefore only need to prove that frame sizes are strictly positive and never larger than maximum frame sizes. This follows from the following induction:
We prove by induction that
$$\begin{aligned} \sigma _j^k < \frac{\alpha ^+_{H_j}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} \end{aligned}$$
for all
k and all
\(1 \le j \le i \le N\), so in particular,
\(\sigma _i^k < C_{H_i}^\mathrm {max}\).
As a base-case, assuming \(j = i\) and \(k = 0\), the proof is trivial.
As a second base case, assume
\(j < i\) and
\(k = 0\). Then:
$$\begin{aligned} \sigma _j^0= & {} \min \left\{ C_{H_j}^\mathrm {max} ,\ \inf _{j< n \le N} \frac{\alpha _{H_n}^-}{\alpha _{H_n}^+} (C_{H_n}^\mathrm {max} - \mu ) - \sum _{j< s< n} \sigma _s^0 \right\} \\\le & {} \inf _{j< n \le N} \frac{\alpha _{H_n}^-}{\alpha _{H_n}^+} C_{H_n}^\mathrm {max} - \sum _{j< s< n} \sigma _s^0 \\\le & {} \frac{\alpha _{H_i}^-}{\alpha _{H_i}^+} C_{H_i}^\mathrm {max} - \sum _{j< s< i} \sigma _s^0 \\\le & {} \frac{\alpha _{H_i}^-}{\alpha _{H_i}^+} C_{H_i}^\mathrm {max} \\= & {} \frac{ BW - \alpha _{H_i}^+}{\alpha _{H_i}^+} C_{H_i}^\mathrm {max} \\< & {} \frac{\alpha _{H_j}^+}{\alpha _{H_i}^+} C_{H_i}^\mathrm {max} \end{aligned}$$
using the assumption that
\(\alpha _{H_j}^+ + \alpha _{H_i}^+ < BW \).
Finally, assume
\(\sigma _p^q < \frac{\alpha ^+_{H_p}}{\alpha ^+_{H_r}} C_{H_r}^\mathrm {max}\) whenever
\(q = k+1\) and
\(i < p \le r\), or
\(q \le k\) and
\(p \le r\) then
$$\begin{aligned} \sigma _j^{k+1}= & {} \frac{\alpha _{H_j}^+}{\alpha _{H_j}^-} \left( \sum _{1 \le n< j} \sigma _n^k + \sum _{j< n \le N} \sigma _n^{k+1} \right) \\= & {} \frac{\alpha _{H_j}^+}{\alpha _{H_j}^-} \left( \sum _{1 \le n< j} \sigma _n^k + \sum _{j< n \le i} \sigma _n^{k+1} + \sum _{i< n \le N} \sigma _n^{k+1} \right) \\\le & {} \frac{\alpha _{H_j}^+}{\alpha _{H_j}^-} \left( \sum _{1 \le n< j} \frac{\alpha ^+_{H_n}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} + \sum _{j< n \le i} \frac{\alpha ^+_{H_n}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} + \sum _{i< n \le N} C_{H_n}^\mathrm {max} \right) \\\le & {} \frac{\alpha _{H_j}^+}{\alpha _{H_j}^-} \left( \sum _{1 \le n< j} \frac{\alpha ^+_{H_n}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} + \sum _{j< n \le i} \frac{\alpha ^+_{H_n}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} + \sum _{i < n \le N} \frac{\alpha ^+_{H_n}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} \right) \\= & {} \frac{ \sum _{n \ne j} \alpha _{H_n}^+}{\alpha _{H_j}^-} \frac{\alpha ^+_{H_j}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} \\\le & {} \frac{ BW - \alpha _{H_j}^+}{\alpha _{H_j}^-} \frac{\alpha ^+_{H_j}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} \\= & {} \frac{\alpha ^+_{H_j}}{\alpha ^+_{H_i}} C_{H_i}^\mathrm {max} \end{aligned}$$
Note, that in the fourth line we use the assumption that
\(H_1 \ldots H_n\) are ordered such that
$$\begin{aligned} \frac{C_{H_i}^\mathrm {max}}{\alpha _{H_1}^+} \ge \frac{C_{H_{i+1}}^\mathrm {max}}{\alpha _{H_{i+1}}^+}, \end{aligned}$$
and the last lines again rely on the fact that the total reservation does not exceed the bandwidth.
To connect the sequence to phase four, we need to find a starting point for the fifth phase. One should notice that credit is decreasing by the slowest rate, by construction of the fifth phase. As a consequence, cumulative credit approaches zero when going from \(t_5\) towards \(t_4\). Furthermore, by construction credit remains negative at all times. For every \(\zeta > 0\) there is a k such that \(\sigma _i^k \le \zeta \) for all \(1 \le i \le N\). Therefore, by choosing a sufficiently large k, we can use phase four to connect to phase five.
Response time of \(u^\epsilon \) The scenario \(u^\epsilon \) maintains a slowest decrease of credit at all times during phase 2 and phase 5. Furthermore, phase 3 and phase 4 have an arbitrarily small duration, and during phase 4 an arbitrarily small drop in credit occurs due to resets. At all times there is a higher priority shaper eligible, which means that the frame \(m \in M\) cannot transmit until \(u^\epsilon \) is over. From this we conclude that, during \(u^\epsilon \), m experiences a response time arbitrarily close to \(t_2\) + \(t_5 - t_4\). Furthermore, \(t_5 - t_4\) is arbitrarily close to the cumulative credit achieved at \(t_5\) divided by the slowest credit slope \(\alpha _{{\mathbb {H}}}^-\).
Obviously, the credit achieved at the end of phase 5 is completely determined by its last sequence of transmissions
\(H_1 \ldots H_N\). We calculate:
$$\begin{aligned} CR ^{u^\epsilon }_{\mathbb {H}}(t_5) = - \sum _{1 \le i \le N} \alpha _{H_i}^- \cdot \sigma _i^0 - \alpha _{H_i}^+ \cdot \sum _{i < j \le N} \sigma _j^0 \end{aligned}$$
and conclude that the scenario
\(u^\epsilon \) generates a response time of
$$\begin{aligned} t_5 - t_0 \approx \left( 1 + \frac{\alpha ^+_{\mathbb {H}}}{\alpha ^-_{\mathbb {H}}} \right) C^\mathrm {max}_{\mathbb {L}} + \frac{\sum _{1 \le i \le N} \left( \alpha _{H_i}^- \sigma _i^0 - \alpha _{H_i}^+ \sum _{i < j \le N} \sigma _j^0 \right) }{\alpha _{{\mathbb {H}}}^-} \end{aligned}$$
Achieving the worst-case response time Finally, we observe that one way to pick a sequence
\(H_1 \ldots H_N\) is by following the construction of minimal credit. Given the definition of minimal credit, it is always possible to construct a sequence
\(H_1 \ldots H_N\) such that for all
i we find:
$$\begin{aligned} CR ^{\min }_{\bigcup _{1 \le i \le n} H_i}= & {} - \alpha ^-_{\bigcup _{1 \le i \le n} H_n} \cdot C_{H_n} + CR ^{\min }_{\bigcup _{1 \le i < n} H_i} \end{aligned}$$
One may verify that such a sequence also satisfies such that
$$\begin{aligned} \frac{C_{H_i}^\mathrm {max}}{\alpha _{H_1}^+} \ge \frac{C_{H_{i+1}}^\mathrm {max}}{\alpha _{H_{i+1}}^+} \end{aligned}$$
holds for all
i, and therefore can serve as a basis for our construction of
\(u^\epsilon \).
Finally, if for this sequence we find
$$\begin{aligned} C^\mathrm {max}_{H_N}\ge & {} \frac{\alpha ^+_{H_N}}{\alpha ^-_{H_N}} \sum _{1 \le j < N} C^\mathrm {max}_{H_j} \end{aligned}$$
then it is easy to verify that the credit attained at
\(t_5\) is in fact the minimum credit. As a consequence, if the sequence based on minimal credit satisfies this property, we have a witness showing our worst-case response time estimate in Theorem
6 is tight.