Version 2 (modified by Zhongwei Yao, on Aug 19, 2012 at 3:16:29 PM) (diff)

Use Hash or Map in POSIX Key

current implementation's problem

There are 2 problems in current implementation of POSIX Key(more details are described next section). #The POSIX key area is not properly extended when the number of threads is increased(dynamically created) if POSIX threads are configured as "unlimited", which is a known bug. #Extra memory is reserved in keys for each thread or task in current implementation, which can be heavy memory overhead when keys increase.= several design approaches =

current implementation

current implementation allocates an array when key creates, which holds all of the threads' or tasks' key value. The pre-allocated array's size is as big as the number of threads in system. It is a waste of memory that allocates key value slot for thread which would not use POSIX key at all. And other problems of current implementation is as current implementation's problem? describes.