aspose file tools*
The moose likes C / C++ and the fly likes Concurrency Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Concurrency Query" Watch "Concurrency Query" New topic
Author

Concurrency Query

Sunil Tiwari
Ranch Hand

Joined: Sep 19, 2006
Posts: 49

Hi Anthony,

Congratulations on your new book!

Two very basic queries on concurrency :

1) How should we manage concurrency to increase performance of our C++ code?

2) What is/are memory model(s) and how does choosing one affects the code performance?

- Sunil

~ Neil (SCJP)
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 57
Sunil Tiwari wrote:
1) How should we manage concurrency to increase performance of our C++ code?


That really depends what you are trying to do. One basic solution is to divide your tasks into the smallest pieces that can be run independently and submit them to a thread pool, which can then divide them between the available processors. Of course, the details will depend on the application, and there are alternatives. I cover this in more depth in my book.

Sunil Tiwari wrote:
2) What is/are memory model(s) and how does choosing one affects the code performance?


Generally, you don't get to choose a memory model --- it is an inherent part of the language you are using.

The memory model defines how the language constructs such as int, or struct map to memory, and how/when changes made to a variable in one thread become visible to other threads. Chapter 5 covers the C++0x memory model in depth.


Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++11 thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
Sunil Tiwari
Ranch Hand

Joined: Sep 19, 2006
Posts: 49

Thanks Anthony for the insight!

Looking forward for your book, which looks like a very interesting read!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concurrency Query