Hack Forums
[C] how to multi-thread efficiently in c++? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] how to multi-thread efficiently in c++? (/showthread.php?tid=5892452)



how to multi-thread efficiently in c++? - pmtobefriend - Oct 6, 2018

I've seen people making some sort of program/bots that can run the same task with simultaenously... 200+ threads running at once. Any tutorial on how to do this? 🤝


RE: how to multi-thread efficiently in c++? - sqsgkrlhdwg - Oct 6, 2018

200+ threads is not efficient.

But here is some papers : http://bfy.tw/KEgH


RE: how to multi-thread efficiently in c++? - 0xDEAD10CC - Oct 6, 2018

Yeah your CPU only has so many hardware threads, so just adding more is stupidity.


RE: how to multi-thread efficiently in c++? - pmtobefriend - Oct 6, 2018

(Oct 6, 2018 06:34 PM)0xDEAD10CC Wrote:  Yeah your CPU only has so many hardware threads, so just adding more is stupidity.

I've seen people with their bots, having an option to run 500 threads. I have no idea what is the real term for this. That's why I've added this to the original post.
I'm talking about running the same program, but simultaneously, doing the task simultenaously x100 times.
how would I do that?


RE: how to multi-thread efficiently in c++? - Auriana - Oct 6, 2018

(Oct 6, 2018 07:19 PM)pmtobefriend Wrote:  I've seen people with their bots, having an option to run 500 threads. I have no idea what is the real term for this. That's why I've added this to the original post.
I'm talking about running the same program, but simultaneously, doing the task simultenaously x100 times.
how would I do that?

The only reason their bots run 500 simultaneous threads is because they have no real understanding of synchronisation and cpu resources. Microsoft recommends if you are going to multithread, to run no more than twice the number of your processor cores. But 99% of problems people use multithreads for can be solved through async and callbacks.