Fdhvdu / ThreadPool

A fastest, exception-safety and pure C++17 thread pool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Work stealing

oschonrock opened this issue · comments

Thank you for writing and publishing this thread pool implementation. It seems like a glaring hole in the C++ STL / Boost etc. As it stands std::async is totally unusable (runs "deferred" or one thread per task and blows up). C++20 offers "new futures", but no task launching/scheduling as far as I can see.

So a pool is totally necessary!

I noticed that your ReadMe says "TODO work stealing". Does you pool take this Sean Parent talk into account?

https://www.youtube.com/watch?v=zULU6Hhp42w&feature=emb_logo

This blog has a minimal implementation which does:

https://vorbrodt.blog/2019/02/27/advanced-thread-pool/
https://github.com/mvorbrodt/blog

Actually, there is a v2 version for this thread pool. I want to do a more flexible design for job selection (It just simply uses queue right now. But what if a user wants to specify which threads run next?) and some fancy features (but rare use cases).
So, work stealing will be in the road map of v2 instead of this one.

I haven't watched the video and blog. I will take a look. Thanks for your information :) .

Thanks. Also I noticed that in your _Ret versiion you don't use std::future at all? Again see the video and the implementation on that blog.

Would make sense no?

fair enough. thanks