apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: Bucket memory allocation (was Re: SMS parm to bucket_foo_create())
Date Sun, 26 Aug 2001 18:35:54 GMT
Cliff Woolley wrote:

>On Sat, 25 Aug 2001, Ryan Bloom wrote:
>
[...]

>(Assume for the purposes of this paragraph that we ARE going to use SMS.)
>It was debated whether the SMS to be used should be looked up by the
>buckets code itself or whether it should be passed in by the caller.
>Passing it in by the caller is what eventually came out seeming the best
>because otherwise the buckets code (which has no way to know what its
>thread ID is) has to go ask the OS for its thread ID and then look up the
>SMS in a hash table or something based on that ID.  If the caller gives it
>to us, the caller (which DOES know the thread ID at some point) can just
>stash a pointer to that thread's SMS somewhere and pass it in to the
>bucket functions and it's constant time instead of pseudo-constant or
>logarithmic or linear or whatever.  On the other hand, now that I'm
>actually implementing that as phase 2, I sort of dislike how cluttered it
>makes the API seem.  So we could take a fork in the road from here and
>leave it up to the buckets to find their thread ID.  Less performant, but
>not terribly bad.  Probably still better than malloc, though the win is
>less clear.  Or we could keep going.
>
IMHO, it's better to pass the SMS through the API than to force the
bucket code to look it up via the thread ID, because looking up the
thread ID isn't necessarily a cheap operation (it may require a system
call on some platforms).

--Brian



Mime
View raw message