Live data from Hacker News

The free lunch is over: a fundamental turn toward concurrency in software (2005)

gotw.ca

71–80 of 101 posts

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#71

Earlier quoted context omitted.

If you actually have concurrency, and you have the hardware able to handle it, why do you not have parallelism? I.e., simply spinning up an actor obviously does not imply concurrency; the classic Erlang 'ping pong' example shows processes waiting to receive a message and responding when they do. Not actually concurrent, despite multiple actors and multiple processor cores it's a sequential program, not a concurrent o…

Concurrency produces parallelism when the concurrent portions can actually run at the same time. That is, between synchronization points which force sequential behavior. It's very feasible to write a concurrent program that overuses (versus what is strictly needed) synchronization points in order to produce something which offers a better codebase (by some measure) but provides no parallelism. You have to remove/mini…

Right, when I said "actually concurrent", I meant the code -could- run simultaneously (or more formally, that the items of execution aren't necessarily causally related). Any sequential operation could be spread out over an arbitrary number of Erlang processes, without it actually being concurrent. That design isn't concurrent, you just are involving a bunch of processes that wait.

That said, you are right that a synch point around a controlled resource (i.e., "we only want to support processing 5 requests at a time") would still have concurrent tasks (i.e., ten requests come in; there is no casual relation between when they run). Of course...that's an intentional point of synchronization necessary for correctness; it still strikes me as a strawman to say that you don't get parallelization for concurrent code, just because you forced a bottleneck somewhere.

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#72
post #63

I recall transactional memory being pitched to take a bite out of lock overheads associated with multithreading. (as opposed to lockless algorithms). Has it become mainstream?

If you use Clojure than yes, software transactional memory is readily available. https://clojure.org/reference/refs

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#73

Earlier quoted context omitted.

If you actually have concurrency, and you have the hardware able to handle it, why do you not have parallelism? I.e., simply spinning up an actor obviously does not imply concurrency; the classic Erlang 'ping pong' example shows processes waiting to receive a message and responding when they do. Not actually concurrent, despite multiple actors and multiple processor cores it's a sequential program, not a concurrent o…

> If you actually have concurrency, and you have the hardware able to handle it, why do you not have parallelism? You can have concurrent tasks but with dependencies between them which means there is no parallelism available. > Can you give me an example of a concurrent program that is not also parallel, due to non-hardware reasons, in Erlang? For example.... > the classic Erlang 'ping pong' example shows processes w…

"You can have concurrent tasks but with dependencies between them which means there is no parallelism available." - that isn't really concurrent then, is it? Concurrency implies running two things concurrently; you're just creating things to wait. No useful work is being done. You broke a sequential task across processes. Just because those processes are stuck on a receive loop doesn't mean they're doing anything. Might as well say your Java program is concurrent because you spun up a second thread that just waits.

That was what I was getting at with my question; arbitrary processes that do their work in a serial fashion...isn't a concurrent program. It's a badly written serial one.

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#74

Earlier quoted context omitted.

> If you actually have concurrency, and you have the hardware able to handle it, why do you not have parallelism? You can have concurrent tasks but with dependencies between them which means there is no parallelism available. > Can you give me an example of a concurrent program that is not also parallel, due to non-hardware reasons, in Erlang? For example.... > the classic Erlang 'ping pong' example shows processes w…

"You can have concurrent tasks but with dependencies between them which means there is no parallelism available." - that isn't really concurrent then, is it? Concurrency implies running two things concurrently; you're just creating things to wait. No useful work is being done. You broke a sequential task across processes. Just because those processes are stuck on a receive loop doesn't mean they're doing anything. Mi…

> that isn't really concurrent then

It is, using standard industry terminology.

Concurrency does not require that concurrent tasks are able to make independent progress at the same time, just that they are in some point of progress at the same time.

Back in 2012 when I was working on my PhD I wrote a paper about an example algorithm with very little inherent parallelism, where even if you have multiple concurrent tasks all making forward progress you may find it extremely hard to actually produce results in parallel, if you want to do a deep dive into this problem.

https://chrisseaton.com/multiprog2012/seaton-multiprog2012.p...

I wrote a poster about it as well for an easier introduction.

https://chrisseaton.com/research-symposium-2012/seaton-irreg...

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#75

Earlier quoted context omitted.

"You can have concurrent tasks but with dependencies between them which means there is no parallelism available." - that isn't really concurrent then, is it? Concurrency implies running two things concurrently; you're just creating things to wait. No useful work is being done. You broke a sequential task across processes. Just because those processes are stuck on a receive loop doesn't mean they're doing anything. Mi…

> that isn't really concurrent then It is, using standard industry terminology. Concurrency does not require that concurrent tasks are able to make independent progress at the same time, just that they are in some point of progress at the same time. Back in 2012 when I was working on my PhD I wrote a paper about an example algorithm with very little inherent parallelism, where even if you have multiple concurrent tas…

Thank you; the example helped clarify for me.

Yes, any time there are shared resources, concurrent tasks can hit synchronization points, and end up bottlenecking on them. Of course, I'd contend that a point of synchronization is a form of serialization, but I agree that the tasks being synchronized would still be described as concurrent (since they don't causally affect their ordering). But such a synchronization is a necessary part of the algorithm you're choosing to use (even prior to SMP support), or it would be completely unnatural to include it. I don't know that it really invalidates the OP's point, that the language didn't remove the bottlenecks you introduced?

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#76

I agree with this article a lot. The layers over layers of software bloat increased with the hardware speed. The general trade-off is: We make the software as slow as possible to have the shortest development time with the least educated programmers. "Hey web dev intern, click me a new UI in the next two hours! Hurry!" This intern-clicks-a-new-UI works because we have a dozen layers of incomprehension-supporting-tech…

The whole software vs hardware and developer vs runtime efficiency discussion is way more nuanced. No, the layers as they are currently are at least partially hindering productivity, because they all have bugs, rather painful limitations and are constantly changing under your feet. There is so much complexity, you don't have a chance to understand it (and the implications of it) completely from the click in a client's web browser all the way to the instructions executed on the server. This is not convenient and nobody (not even Google, Facebook and others) can handle the complexity, which manifests itself in bugs, weird behaviour, surprising security holes, other rare defects and more every day.

You don't want to manage memory manually unless you absolutely have to. Almost certainly, it is going to be way more demanding, you will make mistakes and the performance will not really be much better if you do whole system benchmarks for like 95% of applications. It is like using mining equipment and explosives to hang a picture on your concrete wall, it is just totally over the top. I am also not denying, there are use cases for something, where most of the responsibility is on you e.g. embedded or infrastructure software. Most people just aren't aware that they need the skill and understanding to reliably and most importantly responsibly wield it. In both cases, there is considerable room for better, more robust tools, and better methods/ practices and a great reduction in developer hubris.

Some have used better hardware for saving on development effort to some degree. There are applications that really need the extra performance to help users do their work in a more convenient way - not just developers. Some of the performance is lost due to systemic inefficiencies such as the web browser and most related technologies. E.g SVG rendering in web browsers is a mine field of bugs and bad performance, so you do the rendering yourself using canvas and JavaScript, which visually is the same thing but there is a lot more work for the developer and e.g. printing/ export into PDF (where you cannot just recalculate) is where you still kind of want the vector graphics capability in some form. Virtualization has enabled slicing of the cores to serve more customers with low cost and readily available compute. We also have way more users and different security expectations now than we used to in the past, so a single machine has to handle and check more stuff or we can use a single machine for stuff that would need a data centre or wouldn't be possible/ feasible before.

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#77
Past related threads:

The Free Lunch Is Over – A Fundamental Turn Toward Concurrency in Software - https://news.ycombinator.com/item?id=15415039 - Oct 2017 (1 comment)

The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software (2005) - https://news.ycombinator.com/item?id=10096100 - Aug 2015 (2 comments)

The Moore's Law free lunch is over. Now welcome to the hardware jungle. - https://news.ycombinator.com/item?id=3502223 - Jan 2012 (75 comments)

The Free Lunch Is Over - https://news.ycombinator.com/item?id=1441820 - June 2010 (24 comments)

Others?

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#78
post #29

Earlier quoted context omitted.

Without in-process multi-threading with OS threads, writing performant parallel code is nearly impossible. Most of the time you have to drop down to C/C++, disable the GIL and implement parallelism there.

Every time someone brings up the GIL and performance, the answer is pretty much always "use a different language for the places you need especially high performance". All this sturm and drang about Python not being performant enough is missing the point. It's not supposed to be the answer to special cases where maximum performance is required! It's a general-purpose language that is built around community and easy re…

Most high-level languages implement their performance critical functions at a lower level. However, languages that rely on a GIL (Python and Ruby) or isolated memory spaces (V8) have an additional hurdle that if you want a model of concurrency with many threads acting simultaneously on a single shared memory space you have to do additional work.

For Python you either have to have your library pause execution of Python bytecode and do multithreaded things on your memory space, allocate an isolated memory arena for your multithreaded work, copy data in and out of it, and then spawn non-Python threads (see PEP 554 for an IRL example of this idea with the Python interpreter itself), or copy data to another process which can do the multithreaded things.

With PEP 554 (right now using the C API) I personally have no issue with multithreaded Python since the overhead of copying memory between interpreters is fast enough for my work but it is overhead.

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#79
post #29

Earlier quoted context omitted.

Without in-process multi-threading with OS threads, writing performant parallel code is nearly impossible. Most of the time you have to drop down to C/C++, disable the GIL and implement parallelism there.

Every time someone brings up the GIL and performance, the answer is pretty much always "use a different language for the places you need especially high performance". All this sturm and drang about Python not being performant enough is missing the point. It's not supposed to be the answer to special cases where maximum performance is required! It's a general-purpose language that is built around community and easy re…

There is nothing about the Python language spec (as gleaned from looking at how CPython works) that forces it to be slow or not handle parallelism. In fact the addition of the massive amounts of library code and language changes to support async show that Python isn't even immune to preventing added complexity.

Re: The free lunch is over: a fundamental turn toward concurrency in software (2005)

#80

Earlier quoted context omitted.

"You can have concurrent tasks but with dependencies between them which means there is no parallelism available." - that isn't really concurrent then, is it? Concurrency implies running two things concurrently; you're just creating things to wait. No useful work is being done. You broke a sequential task across processes. Just because those processes are stuck on a receive loop doesn't mean they're doing anything. Mi…

> that isn't really concurrent then It is, using standard industry terminology. Concurrency does not require that concurrent tasks are able to make independent progress at the same time, just that they are in some point of progress at the same time. Back in 2012 when I was working on my PhD I wrote a paper about an example algorithm with very little inherent parallelism, where even if you have multiple concurrent tas…

> It is, using standard industry terminology.

Just to add some support here, concurrency definitely has very little to do with actual independence of progress. It has far more to do with encapsulation of knowledge (for an active agent, not a passive entity like an object [^]), and how different agents coordinate to exchange that knowledge.

An echo server + client is a concurrent system, despite having only one meaningful scheduling of actions over time (i.e. no interleaving or parallelism). Serialization and parallelism are both global properties, as they require a perspective "from above" to observe, while concurrency is a property local to each task.

I can appreciate everyone is saying upthread, but I've definitely found it valuable to think about concurrency in these terms.

[^] Even this is overselling it. You can easily have two logical tasks and one physical agent responsible for executing both of them, and this is still a concurrent system. Dataflow programming is a lot like this -- you're not really concerned with the global parallelism of the whole system, you're just describing a series of tasks over local knowledge that propagate results downstream.

Post reply on HN