In a virtual memory system, the address space is partitioned into pages, and main memory serves as a cache to the disk. The problem we address is: Given a tree T, find a packing, an allocation of its nodes to pages, which optimizes the cache performance. We investigate a model for tree access in which a node is accessed only via the path leading to it from the root. Two cost functions are considered: the total number of different pages visited in the search, and the number of page faults incurred. It is shown that both functions can be optimized simultaneously. An efficient dynamic programming algorithm to find an optimal packing is presented. The problem of finding an optimal packing which also uses the minimum number of pages, is shown to be NP-complete. However, an efficient approximation algorithm is presented. This algorithm finds a packing that uses the minimum number of pages, and requires at most one extra page fault per search. Finally, we study dynamic trees which allow insertions and deletions.
KeywordsBinary Tree Optimal Packing Page Fault Cache Performance Space Consumption
Unable to display preview. Download preview PDF.
- 1.A. Aggarwal, B. Alpern, A. K. Chandra, and M. Snir. A model for hierarchical memory. In Proceedings of the 19th Annual Symposium on Computing, pages 305–314, New York, 1987.Google Scholar
- 2.A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: principles, techniques, and tools. Addison-Wesley, Reading, Massachusetts, 1988.Google Scholar
- 3.T. Cormen, C. Leiserson, and R. Rivest. Introduction to Algorithms. McGraw Hill and The MIT Press, 1990.Google Scholar
- 4.B. Farizon. Local and global memory for the implementation of ray tracing on a parallel machine. Master's thesis, Computer Science Dept., Technion — Israel Institute of Technology, 1995.Google Scholar
- 5.J. D. Foley and A. V. Dam. Fundamental of Interactive Computer Graphics. The Systems Programming Series. Addison-Wesley, Reading, Massachusetts, 1984.Google Scholar
- 6.S. Gal, Y. Hollander, and A. Itai. Optimal mappings in a direct mapped cache environment. Math. Programming B, 63:371–387, 1994.Google Scholar
- 7.M. R. Garey and D. S. Johnson. Computers and Intractability, A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, 1979.Google Scholar
- 8.C. F. Goldfarb. The SGML Handbook. Clarendon Press, Oxford, 1990.Google Scholar
- 9.M. S. Lam, E. Rothberg, and M. E. Wolf. The cache performance and optimizations of blocked algorithms. In Fourth International Conference on Architectural Support for Programming Languages and Operation Systems (ASPLOS IV), 1991.Google Scholar
- 10.M. E. Wolf and M. S. Lam. A data locality optimizing algorithm. In Proceedings of the ACM SIGPLAN'91 Conference on Programming Language Design and Implementation, 1991.Google Scholar