摘要 |
Disclosed are a method and an apparatus for querying and traversing a virtual memory area. The method comprises: determining whether a virtual memory area vma corresponding to a queried address is in an adjacent range of a cache vma, the adjacent range of the cache vma comprising an address range of at least one former adjacent vma and an address range of at least one latter adjacent vma of the cache vma; and if yes, querying the vma through a thread on a node of a threaded red-black tree, the node being a node corresponding to the cache vma, and the thread is a pointer pointing at a predecessor node and a successor node of each node on the threaded red-black tree. Further disclosed is a method for traversing a virtual memory area. Because acknowledgement for the adjacent range of the cache vma can always be met, thereby improving the hit rate of accessing the cache, and achieving the time complexity of the entire vma traversal being 0(n), so as to improve the querying efficiency of the vma. |