Re: The Hoard Scalable Memory Allocator
- From: rani_sharoni@xxxxxxxxxxx
- Date: Wed, 17 Oct 2007 21:02:16 -0700
On Oct 16, 6:19 pm, "Chris Thomasson" <cris...@xxxxxxxxxxx> wrote:
<rani_shar...@xxxxxxxxxxx> wrote in message
news:1192564091.189188.202100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 14, 9:37 pm, "Chris Thomasson" <cris...@xxxxxxxxxxx> wrote:
<rani_shar...@xxxxxxxxxxx> wrote in message
On Oct 12, 6:35 am, "Chris Thomasson" <cris...@xxxxxxxxxxx> wrote:
________________________
- create a thread-local instance of a user-defined single-threaded
allocator in every thread (e.g., ms heap w/ HEAP_NO_SERIALIZE).
- allocation requests are forwarded to this thread-local user
allocator
directly.
What happens when a thread exits and there are still outstanding
allocations related to its heap?
Excellent question. This can be VERY important. For instance, I have
built
several single-threaded allocators that are entirely based on the memory
provided by their own stacks. The stack goes bye-bye when its parent
thread
exits! That scenario is handled by recognizing a specific condition that
indicates that other threads have references before it exits. If other
threads have references, it waits on a condition-variable.
Bounding the ref-counting (of outstanding allocations) to the thread
itself seems to be usage sensitive for which there might be use cases
in which threads are exhausted.
Don't you think that it makes more sense to bound the ref-counting to
the heap itself?
The only time I have to bind the counting to the thread is when a user
defined allocator depends on thread local sturcutres. I created an allocator
for it that is based on thread stacks, therefore its bound to the thread.
In that case you can even recycle "thread-less" heaps when new threads
are created and therefore to bound the number of heaps with the total
number of threads.
I'm referring to the HeapAlloc use case and not thread's stack that
you mentioned.
Bingo! I use exactly that for every but the per-stack allocator. You are
catching on to how my allocator works.
(not sure how you can accomplish that in portable and
reliable way).
I have to put vZOOM on Quadros OS for an ARM processor... The setup had no
heap! However, a Quadros task has some stack space... So, I simply created a
single threaded allocator per-task that used this space. I plugged it into
vZOOM via. single api call, and it worked. Bingo, they had a highly
scaleable heap out of thin air!- Hide quoted text -
- Show quoted text -
What is the point of creation and destruction of the per-thread heap?
There are case in which you don't control the creation and destruction
of threads (e.g. MS kernel32.dll thread-pool and thread from external
components calling my DLL).
Thanks,
Rani
.
- Follow-Ups:
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- References:
- The Hoard Scalable Memory Allocator
- From: Emery Berger
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: David Schwartz
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: David Schwartz
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: David Schwartz
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: David Schwartz
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: Sascha Bohnenkamp
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: rani_sharoni
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- Re: The Hoard Scalable Memory Allocator
- From: rani_sharoni
- Re: The Hoard Scalable Memory Allocator
- From: Chris Thomasson
- The Hoard Scalable Memory Allocator
- Prev by Date: Re: Pre-emptive multithread programing....
- Next by Date: Re: qustion about hoards allocator
- Previous by thread: Re: The Hoard Scalable Memory Allocator
- Next by thread: Re: The Hoard Scalable Memory Allocator
- Index(es):
Relevant Pages
|