title: CUDA Thread Scheduling: custom thread swapping/event based locks?
body: <p>I am trying to configure the following <a href="https://devblogs.nvidia.com/parallelforall/introduction-cuda-dynamic-parallelism/" rel="nofollow">nested thread architecture</a>.</p>
  
  <pre><code>|   |   |
  |   |   |
  ||| ||| |||
  |vv |vv |vv
  v   v   v
  </code></pre>
  
  <p>The main threads only continues after the nested threads have completed.</p>
  
  <p>The problem is that in larger structures I may run into starvation problems as the nested threads run into what currently are custom locks with a standard mutex while loop. This won't be an issue until the program loads more threads that the GPU can actually run simultaneously. Is there a way to swap between active threads based on mutex logic?</p>