Lock of TkbmMWCustomResolver

Home Forums kbmMW Lock of TkbmMWCustomResolver

Viewing 3 reply threads
  • Author
    Posts
    • #55098
      TomYU
      Participant

      hi,kim

      why use TCriticalSection for TkbmMWCustomResolver, but not use TkbmMWLock?

    • #55106
      Babis Michael
      Participant

      Kim is using TCriticalSection a lot as i can see …

      Is TkbmMWLock better ? Kim ?

    • #55124
      kimbomadsen
      Keymaster

      Hi,

      Sorry for the delay in replying… trying my best to keep up with all my chores 😉

      TkbmMWLock in its native (kbm) representation is much better than TCriticalSection since it use a high performance multiple reader exclusive writer algorithm with features to track which locks are held by which thread if that is of interest in a debugging situation. With very few threads there will not be much difference.
      With large number of writer and reader threads doing many iterations, there will be a significant difference.

      However TCriticalSection was the standard back in the days before MREW’s and later the kbmMW lock version of MREW. For that reason there are a few (not many) TCriticalSection instances at places.

      The biggest challenge in using mutexes is to minimize its use. Hence delay using the mutex until it is absolutely needed, and release it as soon as possible. Most of kbmMW has been designed with that thought in mind, why the use of TCriticalSection is not really a bottleneck in the places it has been used.

    • #55132
      tomyu666
      Participant

      hi,

      Thank you for your reply, let me understand.

      best regards.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.