Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 13978
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: Sun May 12 17:32:36 CEST 2024

Total time taken to generate the page: 0.01973 seconds