• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrency Query

 
Sunil Tiwari
Ranch Hand
Posts: 49
Clojure Redhat Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anthony Aj Williams
author
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sunil Tiwari
Ranch Hand
Posts: 49
Clojure Redhat Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anthony for the insight!

Looking forward for your book, which looks like a very interesting read!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic