The Trouble with Multicore(spectrum.ieee.org)
spectrum.ieee.org
The Trouble with Multicore
http://spectrum.ieee.org/computing/software/the-trouble-with-multicore
26 comments
Counterpoint: The solution is multicore. http://www.darrylgove.com/2010/06/solution-is-multicore.html "1. Many problems just need parallelising once. 2. Given a number of cores, it is almost always possible to find work to keep them busy. 3. There are very few day to day tasks that are actually limited by processor performance."
Repost of http://news.ycombinator.com/item?id=1477776
My response to this still stands: the problem is an education problem, little more. Read the full response here: http://news.ycombinator.com/item?id=1478331
My response to this still stands: the problem is an education problem, little more. Read the full response here: http://news.ycombinator.com/item?id=1478331
The "trouble" is only when you want a single process to monopolize the entirety of CPU resources. In today's (and even yesterday's?) processing environment, there are often tens if not hundreds of processes running at once, and 5 or 15 of them may be "performance critical".
Are multicore architectures not able to distribute this sort of load?
Are multicore architectures not able to distribute this sort of load?
On PCs it's common to have hundreds of processes sleeping, but rare to have more than one or two threads runnable.
How many different things can a human being think about at once? Maybe 5? 10? probably not an order of magnitude more than that. Maybe part of the problem is that we are running into some limitations of the human brain. Education may help, but maybe we should also take care that we aren't trying to jam round pegs into square holes.
Software development passed outside the realm where a single human brain could fully comprehend the entirety of the project at every level of detail about 5 decades ago. The question is not whether abstractions are required to allow human brains to deal with threading, that's a given, the question is whether or not we have the right abstractions.
Thats due to the fact that C++ is still without a standardized thread library, which works across all platforms.
Thus new students who start by C, C++ dont have proper exposure to the concepts of writting multi threaded applications.
I guess it is single biggest argument against C++
This is untrue. First there is a stable boost::thread library available for a while, and second threads made it to the standard as well as futures.
I don't think the problem is the lack of a thread library, concurrency requires more than just being able to spawn and wait for threads.
Things like tasks managers, concurrent containers and transactional memory wrappers are better answers to the problem.
I don't think the problem is the lack of a thread library, concurrency requires more than just being able to spawn and wait for threads.
Things like tasks managers, concurrent containers and transactional memory wrappers are better answers to the problem.
As someone who learned C++ few years back let me tell you that professors in Universities actively discourage use of Boost.
There is C++0x or which contains hashset and hashtable but even use of it is discouraged.
I think C++ standardization effort has become a joke and I doubt when we will see them being used in real life.
Even funny are people who claim to be waiting for emergence of D.(my professor said that he was waiting for andrecue or some one to finish his D book)
There is C++0x or which contains hashset and hashtable but even use of it is discouraged.
I think C++ standardization effort has become a joke and I doubt when we will see them being used in real life.
Even funny are people who claim to be waiting for emergence of D.(my professor said that he was waiting for andrecue or some one to finish his D book)
As someone who learned C++ few years back let me tell you that professors in Universities actively discourage use of Boost.
I'm curious - why is this? Do they just not like students leaning on libraries at all, or is it something specific about Boost? I suppose supporting an entire classroom of students trying to install/build the thing across a dozen different operating system versions might be something that a professor would want to avoid, but this is a general problem with most tools, so I don't think it should be such a show stopper...
For me, Boost is to C++ as Apache Commons is to Java: literally the first thing I drop in to any project where I'm going to be doing heavy lifting. To some extent, these two mature and highly useful libraries (I guess I should say collections of libraries, really) are the main things the corresponding languages have going for them.
C++ without Boost is just an exercise in pain and humiliation, IMHO...
I'm curious - why is this? Do they just not like students leaning on libraries at all, or is it something specific about Boost? I suppose supporting an entire classroom of students trying to install/build the thing across a dozen different operating system versions might be something that a professor would want to avoid, but this is a general problem with most tools, so I don't think it should be such a show stopper...
For me, Boost is to C++ as Apache Commons is to Java: literally the first thing I drop in to any project where I'm going to be doing heavy lifting. To some extent, these two mature and highly useful libraries (I guess I should say collections of libraries, really) are the main things the corresponding languages have going for them.
C++ without Boost is just an exercise in pain and humiliation, IMHO...
I wish my professor would listen, this is the course i took http://www.ecs.syr.edu/faculty/fawcett/handouts/webpages/CSE....
The worst part was that we were supposed to parse C++ code without use of any standard grammar system. even regexp werent allowed. We only got a tokenizer.
Yowza, Microsoft all over the place in that course...I weep for the commuter student that runs OS X at home and has no desire (or disk space) to dual boot Windows.
That said, the restriction against Boost may be primarily to ensure that people don't rely too much on its features, which would make a lot of those projects almost trivial to solve without actually demonstrating mastery of the underlying concepts. So I suppose it's a worthwhile exercise, but it does bring attention to the main problem with many CS courses, which is that there's never enough emphasis on reusing what other people have already done, whereas when you're programming outside academia, the first thing you should always do is check if someone's already written the code you're about to waste a week on...
That said, the restriction against Boost may be primarily to ensure that people don't rely too much on its features, which would make a lot of those projects almost trivial to solve without actually demonstrating mastery of the underlying concepts. So I suppose it's a worthwhile exercise, but it does bring attention to the main problem with many CS courses, which is that there's never enough emphasis on reusing what other people have already done, whereas when you're programming outside academia, the first thing you should always do is check if someone's already written the code you're about to waste a week on...
Yawn. Another "OMG programmers can't handle multicore!" bullshit article.
I do threads all the time, and there are lots of things out there like various MapReduce toolkits that make it even easier than dealing directly with threads if you want. Threads are not that hard. It just takes an understanding followed by some practice to get a sense for it.
I do threads all the time, and there are lots of things out there like various MapReduce toolkits that make it even easier than dealing directly with threads if you want. Threads are not that hard. It just takes an understanding followed by some practice to get a sense for it.
Disagree. Writing programs that are correct with multiple threads is harder than writing single-threaded program (remember that if you're motivated enough to post about it, you're in the top 0.1% of programmers).
But that aside, writing programs that are truly faster and, more importantly, that scale reasonably with the number of threads, compute resources, other resources, &c is far harder. Have you profiled your code? Have you had the experience of untangling serializations around locks? Have you had the experience of having to custom-code your own sync primitives because locking overhead started to kill you? Are you graphing performance over number of threads under stress? I've worked on projects like that, watched the curves flatten (and sometimes dip), and I don't think scalable multicore code is anywhere nearly as simple as "man pthread, and remember to lock and unlock in the right order".
I'm not trying to say you don't know what you're talking about. I'm saying that you're underestimating the amount of work that goes into making fast multithreaded designs work; you may do all this stuff without even thinking about it, but you have to remember that this is work that you don't have to do at all in "normal" nonscalable designs.
But that aside, writing programs that are truly faster and, more importantly, that scale reasonably with the number of threads, compute resources, other resources, &c is far harder. Have you profiled your code? Have you had the experience of untangling serializations around locks? Have you had the experience of having to custom-code your own sync primitives because locking overhead started to kill you? Are you graphing performance over number of threads under stress? I've worked on projects like that, watched the curves flatten (and sometimes dip), and I don't think scalable multicore code is anywhere nearly as simple as "man pthread, and remember to lock and unlock in the right order".
I'm not trying to say you don't know what you're talking about. I'm saying that you're underestimating the amount of work that goes into making fast multithreaded designs work; you may do all this stuff without even thinking about it, but you have to remember that this is work that you don't have to do at all in "normal" nonscalable designs.
I'm not trying to say you don't know what you're talking about.
Heh, maybe I'm becoming an HN cynic but I clicked 'comments' with the near certain expectation of finding an upvoted comment of someone calling David Patterson an idiot.
Heh, maybe I'm becoming an HN cynic but I clicked 'comments' with the near certain expectation of finding an upvoted comment of someone calling David Patterson an idiot.
I've a possibly silly question: since cache misses can dominate performance even in the single-core case, why don't they use all that silicon to make one core with craptons of on-die cache?
Presumably because at a given level of performance L2 cache size and die size/complexity don't have favorable scaling properties. You can ask this question to Google almost verbatim and find articles talking about SRAM ports and stuff.
The beauty of multicore scaling is that it scales.
The beauty of multicore scaling is that it scales.
Threads are not that hard.
I wouldn't quite say that, but perhaps rephrase it to Multicore is not that hard. Or maybe Concurrency is not that hard. (Basically, threads are just one abstraction for multicore/concurrent programming and I think its harder than some of the alternatives - its certainly a lower-level approach than others).
In any case, it isn't that hard. The problem is we're being educated to program sequentially and very little effort (relatively speaking) is being put into educating programmers to program concurrent/parallel multicore software. You cannot simply write a sequential program and then magically make it multi threaded. Good sequential algorithms are not good multicore algorithms and vice versa.
My response to the previous time this was posted to HN (linked in my other comment) explains what I mean.
I wouldn't quite say that, but perhaps rephrase it to Multicore is not that hard. Or maybe Concurrency is not that hard. (Basically, threads are just one abstraction for multicore/concurrent programming and I think its harder than some of the alternatives - its certainly a lower-level approach than others).
In any case, it isn't that hard. The problem is we're being educated to program sequentially and very little effort (relatively speaking) is being put into educating programmers to program concurrent/parallel multicore software. You cannot simply write a sequential program and then magically make it multi threaded. Good sequential algorithms are not good multicore algorithms and vice versa.
My response to the previous time this was posted to HN (linked in my other comment) explains what I mean.
Exactly. For example, process forks are much lighter in overhead than they used to be (depending on the platform), and for long running processes their initiation and termination is insignificant compared to the overall task time. Processes are conceptually easier for people to get started with when starting development of concurrent software.
My current quad core is running about 550 processes at near-idle. Their workload is distributed across cores with no effort. Most Apache implementations use multiple processes for the workers, as an example.
The idea that multi-core code has to have threading actually slows development, because it's a more difficult concept to implement correctly. Multiple processes get the job done as well in many instances, and since each process is single threaded it's easier to implement and maintain.
My current quad core is running about 550 processes at near-idle. Their workload is distributed across cores with no effort. Most Apache implementations use multiple processes for the workers, as an example.
The idea that multi-core code has to have threading actually slows development, because it's a more difficult concept to implement correctly. Multiple processes get the job done as well in many instances, and since each process is single threaded it's easier to implement and maintain.
Whether memory is shared by default (threads) or explicitly (processes) is a little bit of a red herring. The thing that makes parallelized designs hard happens at a higher level: it's that whatever your shared resources are (files, databases, shared memory, in-core databases hanging off message listeners, etc), you have to find a design that allows things to be shared and correct, and that's a hard balance to strike.
You are assuming shared memory as the communication medium. When using processes, you can use sockets for IPC for example. The advantage is that the application can then scale beyond a single system with no change - something that's impossible to do with threads.
It's easier to implement and more scalable. Far from a red herring, the persistent focus on threads for concurrency imposes limitations that are unnecessary in modern systems, and slows development.
Pretty sure you and I just said the same thing, though let me just add that just because you hang something off a socket doesn't mean your design can't serialize around it. Having 100 concurrent workers doesn't help if all of them are just lining up waiting for another program to answer their messages.
Of course, this is the exact same problem you have when you try to make a naive design concurrent by wrapping all the global variables in mutexes.
Of course, this is the exact same problem you have when you try to make a naive design concurrent by wrapping all the global variables in mutexes.
[deleted]
Threads are difficult. Concurrency is easier because most of it can be pushed to Databases, Web servers, ThreadPools, etc.
The heavy lifting has been done almost even before the crisis started.
The heavy lifting has been done almost even before the crisis started.
Insert FP rant here
2. Maybe they are jumping ahead to "many-core". Instead ask: what can we do with this extra silicon? In the past this lead to cache; pipelining; a faster multiplication technique; on-board maths "co"-processor. Today, it gives us systems-on-a-chip; hardware video-decoding; absurd GPUs; and even physics PUs.
I spoke to the person who developed that multiplication technique, and he said that it was due to extra silicon being available - it was inconceivable before then, in that people did not conceive of it because they could not conceive of something so wasteful of silicon.