my dog learned polymorphism*
The moose likes C / C++ and the fly likes A future with thousands of CPU cores? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "A future with thousands of CPU cores?" Watch "A future with thousands of CPU cores?" New topic
Author

A future with thousands of CPU cores?

Terry Harple
Greenhorn

Joined: Apr 19, 2011
Posts: 2

What challenges to current concurrency methodologies do you foresee in a future where thousands of CPU core become the standard?

Terry Harple
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Terry Harple wrote:What challenges to current concurrency methodologies do you foresee in a future where thousands of CPU core become the standard?


That is a good question. The primary shift I see is a move away from manual control of threads to higher level code where the library controls the number of threads and the distribution of work between them. The C++0x facilities have the beginnings of such support in the form of std::async, where the library can choose whether the task is run on its own thread or on the first thread to wait for the task to complete. However, in time I think we will see things move towards parallel algorithms (parallel_for_each etc) and things like dataflow frameworks where you specify the relationships between tasks and let the library handle the concurrency.


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
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

Hi Anthony,

Another question related to multiple cores...

How the new C++0x enables the use of multi-cores, is it really matured enough to that level or still evolving?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Vijitha Kumara wrote:How the new C++0x enables the use of multi-cores, is it really matured enough to that level or still evolving?


The C++0x memory model is designed to handle multiple cores, and multiple processors. At that level it has matured enough: no more language changes should be necessary. Compiling a single program across multiple types of processor might require further changes though --- Microsoft's recently announced C++AMP uses the "restrict" keyword to specify code that can run on a GPU, for example.

The libraries will continue to evolve --- the C++0x library itself is useful, but higher level libraries will make things much easier to deal with.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

Thanks Anthony...
...but higher level libraries will make things much easier to deal with.

Agree, JDK 5 concurrent package is one of the best examples for this...

Brian Overland
author
Ranch Hand

Joined: Sep 09, 2011
Posts: 36
Wow, I bow both to the questioner here -- who asks a wonderful question -- and to Anthony AJ, whose answers, I think, are superb.

It should be noted that C++... with the new C++0x standard... is making serious moves to dealing with the multiple CPU future. I must apologize that I did not go much into the multi-thread material in my book, C++ Without Fear, because it is aimed at the beginner through intermediate programmer principally, and (at the moment at least) I see multi-threading as a very serious, super advanced subject. But someone is going to need to supply some solid examples and guidance on it. AJ?

There is also another possibility. Consider that in general, the move over the last few decades (in fact, since the 1950s!) has been away from programming "down to the hardware" and toward letting high-level tools, such as compilers, optimize the use of hardware for you. For example, some of the formerly cool programming tricks of C and C++ (such as declaring register variables) are now almost irrelevant, because the finest optimizer compilers... such as Microsoft... do this automatically for you.

So I can forsee a future where the finest optimizing compilers figure out for you how to download part of the work and delegate it to other processors. This ALREADY happens to some degree internally on today's computers... in which memory caching, video memory, and notably floating-point tasks are all handed off to other processors. This happens at such a low level now that most programmers (unless they are very hardware sophisticated) ever see it or are aware of it.

But yes, in the future it's going to be more important to master the parts of the C++0x spec that deal with multi-threading. If it's important to deal with multiple threads now, it can also be addressed by working with operating system calls.

Because C++ (and C++0x specifically) are state-of-the-art, if you are concerned with sophsticated handling of threads, it is a good reason to start learning C++ now... even with (as with my book) you start with the fundamentals.

Those are just my random thoughts on the subject. Hope this helps,

Brian O.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A future with thousands of CPU cores?
 
Similar Threads
Stoping all threads in a ThreadPoolExecutor
yield()
rounded textbox & buttons
OSGi and Equinox : OSGi future
WA #1.....word association