Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-829

NAKACK: use CAS to determine whether to acquire the lock in NAKACK

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.7
    • None
    • None

      Currently, we acquire a lock for the NakReceiverWindow for a given sender S. If we have 20 threads for S, then all will add their message to the NRW, then block on the lock. 1 thread will be acble to acquire the lock, all other 19 will block. When the other threads are finally able to acquire the lock, they will return immediately because the first thread already removed and processed all messages.
      GOAL:
      There should only be one thread for S acquiring the lock and processing the message for S. In the above example, all 19 threads for S will return immediately without acquiring the lock and without blocking.

      SOLUTION:
      Use a CAS to determine whether a thread need to acquire the NRW lock or not. If not, return immediately. This way, a thread is available in the pool for other msgs to get processed.

      We need to make sure that a thread doesn't return when reading the CAS, and immediately afterwards, the other (processing) thread returns, so we have no thread processing the messages !

              rhn-engineering-bban Bela Ban
              rhn-engineering-bban Bela Ban
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: