llunak added a comment.

In D122975#3427008 <https://reviews.llvm.org/D122975#3427008>, @clayborg wrote:

> I had tried something similar with the thread pools when trying to 
> parallelize similar stuff. The solution I made was to have a global thread 
> pool for the entire LLDB process, but then the LLVM thread pool stuff needed 
> to be modified to handle different groups of threads where work could be 
> added to a queue and then users can wait on the queue. The queues then need 
> to be managed by the thread pool code. Queues could also be serial queues or 
> concurrent queues. I never completed the patch, but just wanted to pass along 
> the ideas I had used. So instead of adding everything to a separate pool, the 
> main thread pool could take queues. The code for your code above would look 
> something like:

I got a similar idea too, but I think it wouldn't work here in this 
threadpool-within-threadpool situation. If you limit the total number of 
threads, then the "outer" tasks could allocate all the threads and would 
deadlock on "inner" tasks waiting for threads (and if you don't limit threads 
then there's no need to bother). That's why I came up with the semaphore idea, 
as that would require threads to acquire slots and "outer" tasks could 
temporarily release them when spawning "inner" tasks (I didn't consider pending 
threads to be a problem, but if it is, then the supposed ThreadPool queues 
presumably could do that somehow too).

But if lldb code is not considered thread-safe to parallelize the module 
loading at this level, then this is all irrelevant. If it's required to 
parallelize only cache loading, then that removes the 
threadpool-within-threadpool situation. I don't know if I understand the code 
enough to try that though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122975/new/

https://reviews.llvm.org/D122975

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to