vmem Resource Allocator
Posted: Sat Jun 21, 2008 6:32 pm
Has anyone here read this paper? I was wondering if I understand it 100%...(Note: I'm only interested in the vmem idea, atm. I'm not doing much with MP's yet, so magazines aren't of my concern.)
I understand the idea relatively well, so I won't bother rewriting that here. The implementation, on the other hand...
vmem seems simple. Each 'arena', or allocator, keeps its 'segments', or allocated regions, in two ways, depending on their status. Moreover, all of the segments' boundary tags are linked together in order as well.
If a segment is free, it is stored in a list determined by its size. So, if the segment's size falls between n and n+1, it is located in freelist[n]. When alloc is called, the appropriate list is determined from the size requested, and a segment is found. Then, if it is too large, it is split, and the remaining half is then put into its correct list. The requested half is taken out of its list, and put into the arena's hash table. (below) The segment is then returned.
If a segment is allocated, however, it is stored in a hash table. When free is called on it, free finds the segment's boundary tag in the hash table, and moves it to the appropriate free list.
As for quantum caching, that simply means that should an alloc come in for objects up to qcache_max that are in the form (n*quantum), we just return an object from a local cache. (local cache as in slab allocation.) That is, we do not return a segment of the arena, but of a separate, independent, cache that feeds off of the arena.
All of this, then, can be used to create, for example, a physical and virtual memory manager, and, with a slab allocator, a malloc interface.
I'm at least semi-on-track, aren't I? Any hits would be lovely.
Thanks,
Alboin
I understand the idea relatively well, so I won't bother rewriting that here. The implementation, on the other hand...
vmem seems simple. Each 'arena', or allocator, keeps its 'segments', or allocated regions, in two ways, depending on their status. Moreover, all of the segments' boundary tags are linked together in order as well.
If a segment is free, it is stored in a list determined by its size. So, if the segment's size falls between n and n+1, it is located in freelist[n]. When alloc is called, the appropriate list is determined from the size requested, and a segment is found. Then, if it is too large, it is split, and the remaining half is then put into its correct list. The requested half is taken out of its list, and put into the arena's hash table. (below) The segment is then returned.
If a segment is allocated, however, it is stored in a hash table. When free is called on it, free finds the segment's boundary tag in the hash table, and moves it to the appropriate free list.
As for quantum caching, that simply means that should an alloc come in for objects up to qcache_max that are in the form (n*quantum), we just return an object from a local cache. (local cache as in slab allocation.) That is, we do not return a segment of the arena, but of a separate, independent, cache that feeds off of the arena.
All of this, then, can be used to create, for example, a physical and virtual memory manager, and, with a slab allocator, a malloc interface.
I'm at least semi-on-track, aren't I? Any hits would be lovely.
Thanks,
Alboin