Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

Changes between Version 2 and Version 3 of Projects/GSoC/PosixKeys


Ignore:
Timestamp:
08/19/12 15:21:20 (12 years ago)
Author:
Zhongwei Yao
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Projects/GSoC/PosixKeys

    v2 v3  
    88=  current implementation  =
    99
    10 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 [wiki:Current_implementation's_problem current implementation's problem] describes.
     10current 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 [wiki:Current_implementation's_problem current implementation's problem] describes.=  one rbtree approach  =
     11
     12In this approach, there is only one rbtree which is used to manage all POSIX Keys' data. If there are m POSIX Keys and t POSIX Threads, and each Thread has m Key values, then there is n(n = m x t) nodes in the global rbtree. A comparison between this approach and one rbtree per thread approach is provided in [wiki:One_rbtree_per_thread_approach one rbtree per thread approach].=  one rbtree per thread approach  =
     13
     14Suppose there are also m POSIX Keys and t POSIX Threads in the system, then each thread maintains one rbtree, all key data of specific thread is in that rbtree. For example, say if each thread has m Key values, then there are m nodes in each thread's rbtree. Here is a comparison between one-rbtree approach and this approach: [wiki:Runtime_and_space_comparison_between_one-rbtree_and_one-rbtree_per-thread_approach][comparison runtime and space comparison between one-rbtree and one-rbtree per-thread approach][comparison].=  hash approach  =
     15
     16there is also a hash approach discussed before[http://www.rtems.org/pipermail/rtems-devel/2012-May/001138.html][(links) runtime and space comparison between one-rbtree and one-rbtree per-thread approach][comparison]. However, it's worst-case runtime is O(n). And it's unacceptable to RTEMS. Another reason that this approach is not desirable is that we would have to add hash code to RTEMS score which is not there now. The other approaches reuse a score object(the rbtree api).