hpx icon indicating copy to clipboard operation
hpx copied to clipboard

Remove staged threads, immediately create thread objects

Open hkaiser opened this issue 2 years ago • 3 comments

  • flyby: more noexcept for combined_tagged_state

hkaiser avatar Apr 11 '22 01:04 hkaiser

This might not be viable after all. All threads that are created immediately either use a cached thread object (with an allocated stack) or create a new thread object (without an associated stack) otherwise. This way, even threads that do not require immediate execution might end up with an allocated stack segment (if the thread object was retrieved from the cache).

This is prone to causing memory issues as too many threads/stacks may be created (the tests here expose exactly that problem).

For now, I don't have any fool-proof idea on how to decide whether a thread needs to run right away, so that it might benefit from being initialized from the thread object cache.

The only solution I see is more intrusive: in addition (or instead of) caching the thread objects, we will have to cache the stack segments. That would allow to minimize the number of created stack segments to the minimal number of concurrently active threads.

For now, I will convert this PR to 'daft' and get back to it after V1.8 has been released.

hkaiser avatar Apr 13 '22 19:04 hkaiser

What is the status of this PR? Should we push it for 1.10 instead?

gonidelis avatar Jan 30 '23 21:01 gonidelis

What is the status of this PR? Should we push it for 1.10 instead?

Yes, let's move this to the next milestone.

hkaiser avatar Jan 31 '23 21:01 hkaiser