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

Changes between Version 7 and Version 8 of Projects/GSoC/PosixKeys


Ignore:
Timestamp:
08/19/12 16:01:41 (12 years ago)
Author:
Zhongwei Yao
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Projects/GSoC/PosixKeys

    v7 v8  
    1010current 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  =
    1111
    12 In 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 next section.=  One rbtree per thread approach  =
     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 * t)''' nodes in the global rbtree. A comparison between this approach and one rbtree per thread approach is provided in next section.=  One rbtree per thread approach  =
    1313
    1414Suppose 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. The comparison between one rbtree approach and one rbtree per-thread approach is provided in next section.=  Hash approach  =
     
    1616There is also a hash approach discussed before([http://www.rtems.org/pipermail/rtems-devel/2012-May/001138.html links]). 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).=  Comparison between one-rbtree and one-rbtree per-thread approach  =
    1717
    18 Suppose, there is '''m''' keys and '''t''' threads, each threads have '''m''' key values, that is there are '''n = m x t''' nodes in one-rbtree approach, and '''m''' nodes in each rbtree in one-rbtree per-thread approach.
     18Suppose, there is '''m''' keys and '''t''' threads, each threads have '''m''' key values, that is there are '''n = m * t''' nodes in one-rbtree approach, and '''m''' nodes in each rbtree in one-rbtree per-thread approach.
    1919 *  Runtime comparison
    2020{| class="wikitable"