Abstract
We describe an algorithm that efficiently implements the first-fit strategy for dynamic storage allocation. The algorithm imposes a storage overhead of only one word per allocated block (plus a few percent of the total space used for dynamic storage), and the time required to allocate or free a block is O(log W), where W is the maximum number of words allocated dynamically. The algorithm is faster than many commonly used algorithms, especially when many small blocks are allocated, and has good worst-case behavior. It is relatively easy to implement and could be used internally by an operating system or to provide run-time support for high-level languages such as Pascal and Ada. A Pascal implementation is given in the Appendix.
- 1 BAYS, C. A comparison of next-fit, first-fit and best-fit. Commun. ACM 20, 3 (Mar. 1977), 191-192. Google Scholar
- 2 BOZMAN, G. The software lookaside buffer reduces search overhead with linked lists. Commun. ACM 27, 3 (Mar. 1984), 222-227. Google Scholar
- 3 BOZMAN, G., BUCO, W., DALY, T. P., ANO TETZLAFF, W. H. Analysis of free-storage algo-{ rithms--revisited. IBM Syst. J. 23, 1 (1984), 44-64.Google Scholar
- 4 BRENT, R.P. Efficient implementation of the first-fit strategy for dynamic storage allocation. Australian Comput. Sci. Commun. 3, 1 (May 1981), 25-34.Google Scholar
- 5 BRENT, R.P. Efficient implementation of the first-fit strategy for dynamic storage allocation. Rep. CMA-R33-84, Centre for Mathematical Analysis, Australian National University, Aug. 1984.Google Scholar
- 6 BRENT, R.P. Dynamic storage allocation on a computer with virtual memory. Rep. CMA-R37- 84, Centre for Mathematical Analysis, Australian National University, Sept. 1984.Google Scholar
- 7 Fox, P. A., HALL, A. D., AND SCHRYER, N.L. The PORT mathematical subroutine library, ACM Trans. Math. Softw. 4, 2 (June 1978), 104-126. Google Scholar
- 8 GEROVAC, B.J. An implementation of new and dispose using boundary tags. Pascal News 19 (Sept. 1980), 49-59.Google Scholar
- 9 HrXT, J.B. A storage management laboratory. Aust. Comput. Sci. Commun. 2, 1 (Jan. 1980), 185-193.Google Scholar
- 10 KAUFMAN, A. Tailored-list and recombination-delaying buddy systems. ACM Trans. Program. Lang. Syst. 6, 1 (Jan. 1984), 118-125. Google Scholar
- 11 KNOWLTON, K.C. A fast storage allocator. Commun. ACM 8, 10 (Oct. 1965), 623-625. Google Scholar
- 12 KNUTH, D. E. The Art of Computer Programming. Vol. 1: Fundamental Algorithms. (2nd edition). Addison-Wesley, Reading, Mass., 1973, Sect. 2.5. Google Scholar
- 13 KNUTH, D. E. The Art of Computer Programming. Vol. 3: Sorting and Searching. Addison- Wesley, Reading, Mass., 1973. Google Scholar
- 14 PETERSON, J. L., AND NORMAN, T. A. Buddy systems. Commun. ACM 20, 6 (June 1977), 421-431. Google Scholar
- 15 ROBSON, J.M. Worst case fragmentation of first fit and best fit storage allocation strategies. Comput. J. 20, 3 (Aug. 1977), 242-244.Google Scholar
- 16 SHORE, J.E. On the external storage fragmentation produced by first-fit and best-fit allocation strategies. Commun. ACM 18, 8 (Aug. 1975), 433-440. Google Scholar
- 17 SHORE, J. E~ Anomalous behavior of the fifty-percent rule in dynamic memory allocation. Commun. ACM 20, 11 (Nov. 1977), 812-820. Google Scholar
- 18 STEPHENSON, C.J. Fast fits--New methods for dynamic storage allocation. In Proceedings of the 9th Symposium on Operating System Principles (Bretton Woods, N.H., Oct. 11-13, 1983). ACM, New York, 1983, pp. 30-32. Google Scholar
- 19 VUILLEMIN, J. A unifying look at data structures. Commun. ACM 23, 4 (Apr. 1980), 229-239. Google Scholar
Index Terms
- Efficient implementation of the first-fit strategy for dynamic storage allocation
Recommendations
New methods for dynamic storage allocation (Fast Fits)
The classical methods for implementing dynamic storage allocation can be summarized thus
First Fit and Best Fit
The available blocks of storage are linked together in address order. Storage is allocated from the first available block of sufficient ...
A comparison of first-fit allocation strategies
ACM '78: Proceedings of the 1978 annual conference - Volume 2Two modifications of the first-fit algorithm of storage allocation presented by Knuth are simulated. They are compared under two measures of efficiency: average allocation search time and memory utilization efficiency.
On the Asymptotic Optimality of First-Fit Storage Allocation
Suppose requests to store files arrive at a storage facility in a Poisson stream at rate 1. Each file is allocated storage space on arrival and each remains independently for an exponential time with mean l/p. The lengths of the files are assumed to be ...
Comments