Discrete Mathematics and Theoretical Computer Science (subm.), by the authors, 26–rev Analysis of Transmissions Scheduling with Packets Fragmentation

We investigate a scheduling problem in which packets, or datagrams, may be fragmented. While there are a few applications to scheduling with datagram fragmentation, our model of the problem is derived from a scheduling problem present in data over CATV networks. In the scheduling problem datagrams of variable lengths must be assigned (packed) into fixed length time slots. One of the capabilities of the system is the ability to break a datagram into several fragments. When a datagram is fragmented, extra bits are added to the original datagram to enable the reassembly of all the fragments. We convert the scheduling problem into the problem of bin packing with item fragmentation, which we define in the following way: we are asked to pack a list of items into a minimum number of unit capacity bins. Each item may be fragmented in which case overhead units are added to the size of every fragment. The cost associated with fragmentation renders the problem NP-hard, therefore an approximation algorithm is needed. We define a version of the well-known Next-Fit algorithm, capable of fragmenting items, and investigate its performance. We present both worst case and average case results and compare them to the case where fragmentation is not allowed.


Introduction
We address the class of transmission scheduling problems in which packets of variable lengths must be assigned into fixed length time slots (see e.g., [3]). Our model of the problem is derived from a scheduling problem present in data over CATV (Community Antenna Television) networks. In particular we refer to Data-Over-Cable Service Interface Specification (DOCSIS), standard of the Multimedia Cable Network System (MCNS) standard committee (see [18] for a detailed description). When using CATV networks for data communication the data subscribers are connected via a cable modem to the headend. The headend is responsible for the scheduling of all transmissions in the upstream direction (from the cable modem to the headend). Scheduling is done by dividing the upstream, in time, into a stream of numbered mini-slots. The headend receives requests from the modems for allocation of datagram transmission. The length of each datagram can vary and may require a different number of mini-slots. From time to time, the headend publishes a MAP in which it allocates mini-slots to one modem or a group of modems. The scheduling problem is that of allocating the mini-slots to be published in the MAP, or in other words, how to order the datagram transmission in the best possible way.
The headend must consider two kinds of datagram allocations: 1. Fixed Location -allocations for connections with timing demands, such as a CBR (constant bit rate) connection. These connections must be scheduled so as to ensure delivering the guaranteed service. Fixed location datagrams are therefore scheduled in fixed, periodically located mini-slots.
2. Free Location -allocations for connections without timing demands, such as a best effort connection. Free location datagrams can use any of the mini-slots.
The headend therefore performs the allocation in two stages. In the first stage it schedules, or allocates, all fixed location datagrams. We assume that after the fixed allocations have been made, a gap of U mini-slots is left between successive fixed allocations. In the second stage all free location datagrams are scheduled. The free allocations must fit into the gaps left by the fixed allocations. One of the capabilities of the system is the ability to break a datagram into smaller pieces called fragments. When a datagram is fragmented, i.e., transmitted over non successive mini-slots, extra bits are added to the original datagram to enable the reassembly of all the fragments at the headend. In a typical CATV network one mini-slot is added to every fragment.
We model the scheduling problem as a bin packing problem. The relation to the bin packing problem should be clear. The items are the free location datagrams that should be scheduled, each of which may require a different number of mini-slots. The bins are defined by the gaps between every two successive fixed allocations in the MAP. The goal is to use the available mini-slots in the MAP in the best way.
Because of its applicability to a large number of applications and because of its theoretical interest bin packing has been widely researched and investigated (see, e.g., [7], [11] and [2] for a comprehensive survey). Since the problem, as many of its derivatives, is NP-hard [8] many approximation algorithms have been developed for it (see, e.g., [12], [14] and [1] for a survey). To analyze the scheduling problem we introduce a new variant of bin packing which we call bin packing with item fragmentation. We convert the scheduling problem into the problem of bin packing with item fragmentation and show that the two are strongly related. The subject of item fragmentation in bin packing problems has received almost no attention so far. This paper concentrates on aspects that were heretofore never researched, such as developing an algorithm for the problem and investigating its performance.
The cost associated with fragmentation renders the bin packing problem nontrivial. In the scheduling problem, where items correspond to datagrams, the cost is due to the extra overhead bits that are added to each fragment for reassembly purposes. Other fragmentation costs can be those resulting from processing time or reassembly delay. It is interesting to note that when the cost associated with fragmentation is ignored the packing problem becomes trivial, and when the cost is very high, it does not pay to fragment items and we face the classical bin packing problem. Hence, the problem is interesting with the middlerange costs. It has been shown in [16] that for non zero cost, the problem of bin packing with item fragmentation is NP-hard.
We present an analysis of the Next-Fit (NF) algorithm, which is perhaps the simplest algorithm for bin packing. The algorithm keeps only one open bin and packs items according to their order, into the open bin. When an item does not fit in the open bin, the bin is closed and a new bin is opened. The NF algorithm is very simple, can be implemented to run in linear time, and requires only one open bin (bounded space).
It is therefore interesting to investigate the performance of such an algorithm before considering other, more complicated, algorithms.
We point out that the practical scheduling problem may actually be somewhat more complicated than the problem we present here since the bins may not be of uniform size. This situation is likely to happen for example when the fixed location allocations are a result of several CBR connections with different intervals between successive allocations. In such cases we may also face a situation where some items are bigger than some of the bins. While the problem of variable size bins is beyond the scope of this paper, we do mention some results we obtained while analyzing this case. The analysis of variable size bins, as well as the analysis of algorithms other than NF, appears in [17].
Our work contains several contributions. We introduce the variant of bin packing with item fragmentation and relate it to scheduling problems where datagrams may be fragmented. Our analysis of the scheduling algorithm contributes new results to the literature of bin packing. Finally, we developed a new technique for average case analysis which has some important advantages over existing techniques.
The remainder of the paper is organized as follows. In Section 2 we formally define the problem. Section 3 presents worst case analysis of the scheduling algorithm. Section 4 is devoted to average case analysis.

Problem Statement and Definitions
In this section we formally define the problem of bin packing with item fragmentation and show its relation to the scheduling problem. We define the problem similar to the classical bin packing problem. In the classical one-dimensional bin packing problem, we are given a list of items L = (a 1 , a 2 , ..., a n ), each with a size s(a i ) ∈ (0, 1] and are asked to pack them into a minimum number of unit capacity bins. To handle fragmentation, we use a discrete version of the problem and add a fragmentation cost function that adds overhead bits to each fragment. We proceed to formally define the problem. Bin Packing with Item Fragmentation (BP-IF) : We are given a list of n items L = (a 1 , a 2 , ..., a n ), each with a size s(a i ) ∈ {1, 2, ...,U}. The items must be packed into a minimum number of bins, which are all the size of U units. When packing a fragment of an item, one unit of overhead is added to the size of every fragment.
The analysis of bin packing algorithms is traditionally divided into worst case analysis and average case analysis. In worst case analysis we are usually interested in the asymptotic worst case performance ratio. For a given list of items, L and algorithm A, let A(L) be the number of bins used when algorithm A is applied to list L, let OPT (L) denote the optimum number of bins for a packing of L, and let R A (L) ≡ A(L)/OPT (L). The asymptotic worst case performance ratio R ∞ A is defined to be A different approach for estimating the performance of an algorithm is an average case analysis. In this case we assume that item sizes are taken from a given distribution H and we try to estimate the performance ratio of an algorithm, when it is applied to a list taken from that distribution. For a given algorithm A and a list of n items L n , generated according to distribution H, the asymptotic expected performance ratio is defined as follows: Schedule Efficiency: To evaluate the performance of a scheduling algorithm A, we compare the channel utilization achieved by A to that of the best possible schedule. Let s(L) denote the total sum of all item sizes in L, the channel utilization of algorithm A is C A (L) = s(L) A(L)·U . The worst case schedule efficiency, which we denote by η A , is exactly the inverse of the worst case performance ratio of A The expected schedule efficiency is the inverse of the expected performance ratio of A: In this paper we analyze the performance of the Next-Fit algorithm. We denote by NF f the version of NF capable of fragmenting items and define the NF f algorithm similarly to NF.
Algorithm In the reminder of this paper we concentrate on the bin packing problem. We calculate both the worst case and the expected asymptotic performance ratio of the NF f algorithm and compare it to known results about the NF algorithm. The schedule efficiency of the algorithms is easily derived from the performance ratio using (3).

Worst Case Analysis
The NF algorithm is the least efficient among all standard bin packing algorithms. The asymptotic worst case performance ratio of the algorithm is the worst possible We now analyze the performance of the NF f algorithm for the problem of bin packing with item fragmentation. As we shell see, the ability to fragment items may considerably improve the performance of the NF algorithm.

Theorem 1 The asymptotic worst case performance ratio of algorithm NF f is R
Proof : We first prove the upper bound and then provide an example to establish the lower bound.
Proof : The NF f algorithm may pack at most two fragments in each bin (one fragment when the bin is opened and another when the bin is closed). There are therefore at most 2 overhead units in a bin which means that the number of bins used when the algorithm is applied to list L is at most ⌈s(L)/(U − 2)⌉. The optimal packing of L requires at least ⌈s(L)/U⌉ bins and the claim follows. ✷ for every U ≥ 6. Proof : We present an example that proves the lower bound. Let us first consider the case where the bin size U is an even number. As a worst case example we choose the following list L: The first item is of size U/2, the next U 2 − 2 items are of size 1. The rest of the list repeats this pattern kU times. The optimal packing avoids fragmentations by packing bins with two items of size U/2, or U items of size 1. The total number of bins used is OPT (L) = (U − 2)k. On the other hand, algorithm NF f fragments each item of size U/2 (except for the first item). Overall 2(kU − 1) units of overhead are added to the packing and the number of bins used by NF f is therefore A worst case example for the case where U is an odd number is similar. The first item in L is of size (U − 1)/2, the next U−1 2 − 1 items are of size 1. The rest of the list repeats this pattern kU times. It is easy to verify that this list produces the same ratio. It follows from the examples that: The combination of the above claims proves the theorem. ✷ There is a considerable difference between the worst case performance ratios of NF and NF f . Since both algorithms work in a similar way, we conclude that the improved performance ratio of NF f is due to its ability to fragment items. Note that the performance ratio of any algorithm that adopts the simple rule of filling a bin whenever an item is fragmented, cannot be worse than that of NF f .
Finally, we point out a few more properties of the worst case performance ratio of the NF f algorithm. The results are taken from [17] and we present them here without a proof.
• When the bin size is very small Theorem 1 does not hold (because items of size 2 are not fragmented). For the values 3 ≤ U ≤ 5 we show that the worst case asymptotic performance ratio of • For a more general case, where r (instead of 1) units of overhead are added to the size of every fragment, it can be shown by similar arguments that R ∞ NF f = U U−2r , for every U > 4r + 2.
• As we mentioned, in the scheduling problem the bins may be of different sizes. We denote by U the average bin size and show that for the case of variable size bins the worst case performance ratio of The worst case results do not change if we allow the items to be of any size, that is, we assume that the size of some items may be larger than the size of some (or all) of the bins.

Average Case Analysis
The worst case analysis we presented, provides an upper bound on the performance ratio of the NF f algorithm. However, from a practical point of view it may be too pessimistic, since the worst case may rarely occur. To learn about the typical behavior of the algorithm we present an average case analysis.
Since the results of an average case analysis depend on the item-size distribution, it is desirable to be able to calculate results for any given distribution. We therefore consider some general item-size distribution assuming only that the items are independent, identically distributed (i.i.d). Let us define the problem in a formal way. Average case analysis of BP-IF: We are give a list of n items L = (a 1 , a 2 , ..., a n ). The size of each item is independently chosen from the finite set s(a t ) ∈ {1, 2, ...,U}. The probability to choose an item of size i is h i , i.e., for all t: h i = Pr(s(a t ) = i). The goal is to pack the items into a minimum number of bins of equal size U. When packing a fragment of an item, one unit of overhead is added to the size of every fragment.
The first average case analysis of the NF algorithm was done by Coffman, So, Hofri and Yao [5] who showed that the asymptotic expected performance ratio for continuous uniform distribution is R ∞ NF = 4 3 . For discrete uniform distribution, in the range s(a t ) ∈ {1, 2, ...,U}, it has been shown in [3] that the NF algorithm has the following asymptotic expected performance ratio: .
Note that the result for the continuous uniform distribution is reached when U → ∞.
The above mentioned results were achieved by using different techniques, all of which are fairly complicated (see, for example [5], [10] and [13]). We present here, what we believe to be a much easier method of calculating the asymptotic expected performance ratio. We first use this method to repeat the analysis of the NF algorithm. We next apply it to the new problem of bin packing with item fragmentation, to find the expected performance ratio of the NF f algorithm.

Average Case Analysis of the NF Algorithm
We use a Markov chain to describe the packing of the algorithm. The state of the algorithm, which we denote by N t , is the content of the open bin after t items were packed. Since the bin size is U and there are n items to pack, the possible states of the algorithm are 1 ≤ N t ≤ U, 1 ≤ t ≤ n. The probability distribution for N t+1 is completely determined by the value of N t , which renders the process a Markov chain. We consider only the cases where the Markov chain describing the algorithm is ergodic. Note that this is very reasonable since the chain is finite and for most item size distributions it would also be irreducible and acyclic, hence ergodic. If the chain is not ergodic, it is necessary to apply the analysis we present on the irreducible part of the chain which is accessible from the initial state (empty bins).
Assume N t−1 = j and the algorithm now packs item a t . If the open bin cannot contain the item, i.e., j + s(a t ) > U, the item is packed in a new bin. The previous open bin contains U − j unused units which we call overhead units. We say that the overhead units "increased" the size of a t and define its combinedsize to be the actual size of the item, plus the overhead units it created. For example, say the algorithm is in state N t = 2 and the next item is of size U. The overhead in this case is U − 2 units and we say the combined size of the item is U +U − 2.
Denote by oh t the overhead added to the size of item a t . For an algorithm A and a list L n of n items, we define the expected average combined size of all items to be We define the expected asymptotic average combined size of all items as Since I A (H) accounts for both the used and wasted space in the bins, we can state the following relation between I A (H) and A(L): We now use a property of the optimal packing that ensures that for any item size distribution the tails of the distribution of OPT (L n ) decline rapidly enough with n [19], so that as n → ∞, E[A(L n )/OPT (L n )] and E[A(L n )]/E[OPT (L n )] converge to the same limit [6]. Therefore the asymptotic expected performance ratio is given by To find the asymptotic expected performance ratio of the NF algorithm, we must calculate both I av (OPT ) and I av (NF). Since bin packing is NP-hard, finding I av (OPT ) for certain item size distributions may require exponential time in n. Fortunately, we do know that for several important distributions, including the uniform distribution, the overhead of the optimal packing can be neglected [2]. For such distributions we have In cases where I av (OPT ) is not known we can still find the channel utilization of the algorithm by replacing I av (OPT ) with h, i.e., the average item size of the given distribution. To find I av (NF) we use the Markov chain describing the algorithm. Denote by P the transition matrix of the Markov chain and by Π = (Π 1 , ...Π U ) the equilibrium probability vector satisfying Π = ΠP. Assume NF packs a long list of n items; denote by n j the number of visits in state j during the packing. Since we consider ergodic chains, we have the following property: Pr lim n→∞ n j n = Π j = 1, which is usually written as lim n→∞ n j n = Π j , a.s. (almost surely). We now denote by n j,i the number of items of size i packed when the algorithm is in state j. The probability for the next item in the list to be of size i, h i , is unrelated to the state of the algorithm. Therefore we can use the Law of large numbers to establish the following property of n j,i : The overhead added to each item is related to both the state of the algorithm and the size of the item. We denote by oh i ( j) the overhead added to an item of size i which is packed when the algorithm is in state j. We calculate the average combined size of the items in the following way: Substituting (11) we get To simplify (13) we use the following definitions: Equation (13) now becomes: The expression in (15) is very intuitive; the asymptotic average combined size of the items is made of the average size of the items plus the average size of the overhead. To calculate the expected performance ratio we must find two components: 1. The equilibrium probabilities of the Markov chain, Π. We find Π by constructing the transition matrix P and calculating the equilibrium probability vector satisfying: Π = ΠP.

The overhead components oh i ( j)
. This is easily obtained from the packing rules of the algorithm.
Our technique of average case analysis has two advantages: it is suitable for analyzing any (i.i.d) item size distribution, both discrete and continuous, and the calculation is relatively easy. These properties are important since in most real-world applications of bin packing the items are drawn from a finite set, which is rarely uniform.
In the next subsection we calculate specific results for the case of discrete uniform distribution.

Discrete Uniform Distribution
Discrete uniform distribution means that h i = 1 U , ∀i. It is easy to see that in this case the Markov chain is ergodic. An important characteristic of the discrete uniform distribution is that the overhead of the optimal packing is negligible. To state it formally, let L n be a list of n items drawn from a discrete uniform distribution H and let s(L n ) be the total size of all items in L n . The expected wasted space of the optimal packing has the following property [4]: From the above result we conclude that lim n→∞ E U·OPT (L n ) s(L n ) = 1. We therefore neglect the overhead of the optimal packing in calculating the asymptotic expected performance ratio. Calculating I av (OPT ) is now trivial We use (15) to find the average combined size of the items. We first find the equilibrium probabilities of the Markov chain. Let P be the U ×U transition matrix describing the chain and let Π = (Π 1 , ..., Π U ) be the equilibrium probability vector satisfying: Π = ΠP. There is a symmetry in the lines of the transition matrix P, in a sense that line j and line U − j are identical. For j ≤ U 2 we have The last line is P U,k = 1 U , 1 ≤ k ≤ U. The simple structure of the matrix P enables an easy solution to the set of equations Π = Π P.
Next we compute the overhead component OH( j). When the NF algorithm is in state j any item bigger than U − j creates an overhead of U − j units; all other items are packed without overhead. Hence, the average overhead in state j is We now use (18) and (19) to find the average combined size of the items We use I av (NF) and I av (OPT ) to obtain the asymptotic expected performance ratio The result we obtain for the asymptotic expected performance ratio is in accordance with results reported in [3]. The asymptotic worst case performance ratio is given in (4). We compare the two, for several values of U, in Table 1. We observe that in both cases the asymptotic performance ratio increases with the bin size. There is, however, a dramatic difference between the worst case performance ratio and the expected performance ratio. The average case results are therefore not as bad as the worst case analysis indicates.

Average Case Analysis of the NF f Algorithm
We now use the same method we used for analyzing the NF algorithm, to analyze the case where item fragmentation is allowed, i.e., the NF f algorithm. In this subsection we assume the items are taken from a discrete uniform distribution, that is h i = 1 U , ∀i. Note that the overhead this time is due to fragmentation or an unused free space (if the content of a closed bin is U − 1).
The first stage in our analysis of NF f , is to find the equilibrium probabilities of the Markov chain. Let us describe the components of the transition matrix P The set of equations defined by Π = Π P is Note that the solution to (25) (if it were the only equation) is Π j = 1 U−2 . Unlike the case of NF, the solution to the set of equations (23)-(25) is not simple. We therefore defer the calculation of a closed form solution to subsection 4.2.1 and proceed to calculate OH( j), the average overhead in state N = j. Note that when an item is fragmented over two bins, 2 units of overhead are added to it. In state N = U − 1 all items of size 2 or more are packed in the next bin, so only 1 unit of overhead is added to them. The average overhead in state N = j is therefore We can now express the average combined size of the items Similar to (16), the overhead of the optimal packing is negligible I av (OPT ) = U+1 2 . The asymptotic expected performance ratio is therefore At this point we do not have a closed form solution to the equilibrium probabilities and therefore we cannot present the expected performance ratio in closed form. It is easy, however, to find a numerical solution for every value of U. In Table 2 we present the asymptotic expected and worst case performance ratio of NF f for several values of U.  Figures 1  and 2 present the asymptotic expected performance ratio of the NF f and NF algorithms together with the worst case performance ratio of NF f . We observe that the difference between the worst case and the average case for NF f is not as significant as in NF, that is, the expected performance ratio of the NF f algorithm is not far from its worst case performance ratio. This is obvious for large values of U since the worst case ratio converges to one, but it also indicates that even under a uniform distribution the NF f algorithm produces almost the worst possible packing. An interesting question, which we leave open, is whether other, more efficient, algorithms can produce a better packing. In this respect we note that in the case where fragmentation is not allowed, there is a big difference between the performance of NF and the performance of other online algorithms, such as First-Fit and Best-Fit, for which the asymptotic expected performance ratio, for any value of U, is [2]: Finally we note that it is not difficult to repeat the analysis we presented, for the general case, where r units of overhead are added to the size of every fragment. We show in [17] that in this case the equivalent of (28) is

Calculating the Expected Performance Ratio
In this subsection we derive a closed form solution of the expected performance ratio. Since this closed form solution is rather complex, we also provide an approximation of the expected performance ratio. The approximation is much easier to use and the approximation error, for all but small values of U, is insignificant. We substitute N = E[N] = ∑ U j=1 j · Π j in (28), to express R ∞ NF f in the following way: To calculate the value of N we use a generating function: G(z) = ∑ U j=1 Π j z j . We use the equilibrium equations (23) -(25) to get Arranging the above expression we get To find N we calculate the derivative of the generating function at z = 1

General Item Size Distribution
In this subsection we demonstrate how the analysis can be applied to any item size distribution. We assume the items are i.i.d and the probability to draw an item of size i is h i . As we mentioned earlier, since finding I av (OPT ) may be difficult, we calculate the bin utilization which requires finding I av (NF f ) only. We use (15) to calculate the average combined size of the items. The construction of the transition matrix and the calculation of the equilibrium probabilities is similar to the one presented in the previous section. The calculation of the overhead component oh i ( j) (overhead added to an item of size i which is packed in state j) is simple Example: We present an example using typical parameters of a data over CATV network. We assume a mini-slot is 25 microsecond and 16 bytes are transmitted in each mini-slot. In data over CATV networks a cable modem transfers IP datagrams using Ethernet packets. We therefore assume the datagram have typical Ethernet distribution with datagram sizes of 4, 8, 16, 64, and 94 mini-slots, and with the following probabilities: h 4 = 0.5, h 8 = 0.1, h 16 = 0.05, h 64 = 0.15, and h 94 = 0.2. The average item size of the given distribution is h = 32. We assume the bin size is U = 100 mini-slots, which corresponds to 2.5 millisecond.
We are interested in the channel utilization of algorithms NF and NF f . Using our average case analysis we find that I av (NF) = 40.5 and I av (NF f ) = 32.6. The channel utilization of NF is therefore C ∞ NF = 0.79. The channel utilization of NF f is considerably better C ∞ NF f = 0.981. The corresponding worst case results for the example are C ∞ NF = 0.505 and C ∞ NF f = 0.98.

Conclusions
We studied a scheduling problem in which datagrams my be fragmented. Such scheduling problem is present in data over CATV networks as well as in several other applications (e.g., [3], [16]). The analysis we presented can also serve as a tool for evaluating the benefits of fragmentation in other systems. For example, several reservation-based satellite systems present a similar scheduling problem to that of data over CATV (see e.g., [9], [15]) but fragmentation is not currently implemented in such systems.
To analyze the scheduling problem we introduced a new variant of bin packing that allows item fragmentation. We converted the scheduling problem into the problem of bin packing with item fragmentation and showed that the two problems are strongly related. We defined the NF f algorithm and performed both worst case and average case analysis to evaluate the schedule efficiency of the algorithm. We developed a new technique, based on calculating the overhead produced during the packing, to derive our average case results. This technique may prove useful in analyzing other problems.
We found that fragmentation can considerably improve the schedule efficiency of an algorithm. An important characteristic is that the schedule efficiency is increasing with the bin size (the gap between fixed allocations). This means that for large bin sizes, the efficiency of NF f is not far from the optimum. While NF f is not very efficient, it may still be chosen as a practical scheduling algorithm since it has some important advantage over other algorithms; NF f is very simple and is suitable for online and boundedspace scheduling. Moreover, it keeps a first-in-first-out order of transmissions.
There are several possible extensions to the work presented in this paper; some of them are addressed in [17]. From a practical point of view, other bin packing algorithms, should also be considered. We expect algorithms such as First-Fit (FF) and First-Fit Decreasing (FFD) [11], to perform better than NF. The improved performance has to be weighed against the advantages of the NF f algorithm. Another interesting extension is to consider the case where the fixed allocations in the MAP create variable size gaps. This time the scheduling problem is modeled as a variant of variable size bin packing.