U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » CoWork and shared memory
Re: CoWork and shared memory [message #35512 is a reply to message #35510] Fri, 24 February 2012 13:52 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
peek wrote on Fri, 24 February 2012 07:04

Great Smile, I understand.

One question: This way it would be better to use CoWork instead of Thread because CoWork always tries to run in all available cores but Thread only runs in actual core?.


Ah, the answer is a bit more complicated. CoWork actually uses thread pool - it creates a couple of threads (number of logical CPU cores + 2) the first time it is used and then uses all these threads to execute everything in parallel. So you are at least saved thread creation/destruction costs. Plus, it uses the very same pool for any nested looping (you can use another CoWork loop nested with within). Actually, it does not even have to be a loop, simply what you run with CoWork will possibly run in parallel and you can be sure that at CoWork destructor, all is finished. The order of running those tasks is of course unspecified.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Point implicit conversions
Next Topic: put32 for double precision values..
Goto Forum:
  


Current Time: Wed Sep 23 13:19:22 GMT+2 2026

Total time taken to generate the page: 0.01642 seconds