tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthread_key_{create,delete} pthread_{g,s}etspecific on NetBSD

On Mon, Dec 03, 2012 at 11:23:39AM -0500, Christos Zoulas wrote:
 > The size increase is not really necessary if you are willing to
 > pay the cost of going through the all_thread list when you remove
 > a key (and hold a different lock). Having said that, even in the
 > case of 1000 threads, this just amounts to 6M of memory on a 64
 > bit host, instread of ~2M, since I've added 2 pointers to the array
 > of 256 keys; you need at least one more to hold the data.

Shouldn't a singly-linked list serve?

Also it seems like it would be better to allocate the space when a key
is added to a thread, e.g. by allocating a resizeable array in the
global structures instead of stuffing list links in every thread.

David A. Holland

Home | Main Index | Thread Index | Old Index