News for hackers. Stuff that matters.
Re:Why has CPU frequency ceased to grow? (2014) by mjfl on Wednesday February 21, 2018 @04:42AM (#16428180)
I took a class that went over this in depth like 3-4 years ago. Basically the message was that serial performance is saturating, and the only way to get speed improvements in the future is going to be by exploiting parallelism. However, most programmers, and programming languages, remain stuck in a serial-by-default paradigm. I'm surprised that there hasn't emerged a "parallel-by-default C++" kind of language + hardware system to exploit it to keep things going forward. I find the apparent stagnation extremely depressing.
Re:Why has CPU frequency ceased to grow? (2014) by madez on Wednesday February 21, 2018 @04:52AM (#16428247)
While Rust doesn't promote a specific model for parallelism, it's stronger compiler helps a lot with that.

https://doc.rust-lang.org/beta/nomicon/concurrency.html

https://doc.rust-lang.org/book/second-edition/ch16-01-thread...

I don't think fixing C(++) can give what Rust can give, because Rust has a clean start with these strong guarantees built-in while for C(++) it would always be an addon. Defaults are powerful.

Re:Why has CPU frequency ceased to grow? (2014) by chrismorgan on Wednesday February 21, 2018 @05:48AM (#16428517)
A really powerful outworking of it is seen in the Rayon crate, where you can change a sequential iterator into a parallel iterator just by adding the crate, importing the trait and changing `iter` to `par_iter`. If it’s not thread-safe to do, then it won’t compile. (That’s the big difference from C++.) If it is, it will, and it’ll be smart about how it runs, spreading the load across all available cores pretty much optimally, or not bothering with multiple threads if it’s not going to be worth it (e.g. single-threaded, or only one item in the iterator). And all that with close enough to no overhead.

Basically, Rayon makes data parallelism really easy in a way that few if any other languages do. I’d love to have an equivalent in Python or Node, but it’s just not possible to achieve such a thing in most languages—even if you ignore the thread safety aspect.

Parallelism hasn’t seen a great deal of use until it’s urgently needed, because it’s hard to get right in most environments, and you normally need to substantially refactor code to make it happen. My hope is that with the likes of Rayon, parallelism can be a much more natural thing that people that care even a little about performance will just do, because it’s so easy to do.

https://crates.io/crates/rayon

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:03AM (#16428803)
> Parallelism hasn’t seen a great deal of use until it’s urgently needed

This is the main reason why, initially, Windows Store APIs were all async.

Microsoft learned that when developers can choose between both models, by default most chose synch models.

Re:Why has CPU frequency ceased to grow? (2014) by romwell on Monday February 26, 2018 @10:47PM (#16470938)
>Basically, Rayon makes data parallelism really easy in a way that few if any other languages do.

Syntax-wise, there's OpenMP which can turn a for-loop into a parallelized for-loop (independently scheduled iterations) with just some syntactic sugar on top of the loop.

OpenMP has support for at least C++ and Fortran, and is not hard to use.

I wonder how Rayon compares to OpenMP.

Re:Why has CPU frequency ceased to grow? (2014) by ethagnawl on Wednesday February 21, 2018 @10:02AM (#16429893)
FWIW, you can also achieve similar behavior in Clojure via pmap, Reducers, etc.
Re:Why has CPU frequency ceased to grow? (2014) by floatboth on Wednesday February 21, 2018 @11:10AM (#16430460)
Re:Why has CPU frequency ceased to grow? (2014) by brazzy on Wednesday February 21, 2018 @11:57AM (#16430855)
To me, the "If it’s not thread-safe to do, then it won’t compile" part sounds rather more notable.
Re:Why has CPU frequency ceased to grow? (2014) by coolsunglasses on Wednesday February 21, 2018 @12:45PM (#16431307)
That's true of Haskell for the parallelism faculties. It's also true for STM. You can still get stuck or have race conditions with the other concurrency abstractions but it's less common than I encountered elsewhere. I didn't have problems resulting from mutable shared state that was aliased across threads and wasn't supposed to be, it's always explicit.
Re:Why has CPU frequency ceased to grow? (2014) by mitchtbaum on Wednesday February 21, 2018 @01:46PM (#16431833)
Another good crate to look at for this is Actix, Rust actors framework:

https://github.com/actix/actix

Re:Why has CPU frequency ceased to grow? (2014) by beojan on Wednesday February 21, 2018 @05:43AM (#16428488)
C++ has parallel algorithms built in (http://en.cppreference.com/w/cpp/algorithm).

Parallelism is complicated though, and easy parallelism pretty much requires a functional style. Things like Haskell's Accelerate library (https://www.stackage.org/package/accelerate) seem the ideal way forward to me.

Re:Why has CPU frequency ceased to grow? (2014) by smitherfield on Wednesday February 21, 2018 @02:12PM (#16432044)
Should be noted that so far only Visual Studio (partially) implements C++17 parallel algorithms, although there are several third-party implementations.[1]

Apples to oranges comparison of course, since Rayon isn't [planned to become?] part of the Rust standard library.

[1] http://www.bfilipek.com/2017/08/cpp17-details-parallel.html#...

Re:Why has CPU frequency ceased to grow? (2014) by beojan on Thursday February 22, 2018 @05:08AM (#16436541)
If you're including third-party libraries, you have things like ArrayFire and Intel TBB.
Re:Why has CPU frequency ceased to grow? (2014) by ilogik on Wednesday February 21, 2018 @06:52AM (#16428757)
Doesn't go also make it relatively easy to write parallel code?
Re:Why has CPU frequency ceased to grow? (2014) by gameswithgo on Wednesday February 21, 2018 @09:37AM (#16429721)
Not especially. It has goroutines, C# has Tasks, C++ has green thread libraries. Added onto this are channels which are basically thread safe queues, other languages have those too. (I am aware that there are differences between what features goroutines and Tasks provides)

Go's implementation of these things is nice, neat, and all included out of the box though which is nice.

In general you can make parallelism easy, or efficient, rarely both, at least not in a way that can solve problems generally.

edit: I should add Go does also come with a data-race detection tool which can be very useful. Not sure any other language includes that out of the box!

Re:Why has CPU frequency ceased to grow? (2014) by burntsushi on Wednesday February 21, 2018 @12:05PM (#16430916)
I think Go does make it relatively easy to write parallel code in comparison to most other frequently used languages.

> Not sure any other language includes that out of the box!

Rust's compiler does it by default, at compile time. ;-) Go's race detector is never wrong, but it may omit things. On the other hand, Rust's compiler is also neither wrong nor does it omit things, except under one circumstance: someone, somewhere, wrote `unsafe` code and committed a bug inside that block.

ThreadSanitizer is also a thing: https://clang.llvm.org/docs/ThreadSanitizer.html

Re:Why has CPU frequency ceased to grow? (2014) by Thaxll on Wednesday February 21, 2018 @11:37AM (#16430677)
Except in other languages it's not part of the core, it's an external library. So on the end it's easy to write "parallel" code.
Re:Why has CPU frequency ceased to grow? (2014) by gameswithgo on Wednesday February 21, 2018 @01:41PM (#16431794)
In C#, Task is part of the language, thread safe queues are part of the core libs.

Still not quite as tightly integrated as Go though.

Re:Why has CPU frequency ceased to grow? (2014) by ztoben on Wednesday February 21, 2018 @08:03AM (#16429107)
I believe you're thinking of concurrency, which go handles pretty well with goroutines.
Re:Why has CPU frequency ceased to grow? (2014) by icedchai on Wednesday February 21, 2018 @09:16AM (#16429554)
Go can use multiple cores. Goroutines will run in parallel (assuming GOMAXPROCS > 1.)
[dead]
Re:Why has CPU frequency ceased to grow? (2014) by gilrain on Wednesday February 21, 2018 @09:27AM (#16429633)
As someone who frequently posts about my personally-excellent experiences with Rust, what makes you suspect it's astroturf rather than just turf? You think Mozilla is paying people to post about Rust using puppet accounts? C'mon.
Re:Why has CPU frequency ceased to grow? (2014) by kibwen on Wednesday February 21, 2018 @04:16PM (#16433040)
Think about it. Mozilla Rust -> Godzilla (C)Rust -> "Godlike" giant lizard crust -> God is radiant -> light -> illumination -> Illuminati lizard people from beneath the Earth's flat crust are funding paid protestors to shill Rust, it's really the only explanation that makes sense.

(The person you're replying to is using the transparent internet argument tactic of trying to cast doubt upon genuine enthusiasm by implying some vague sinister motive, conveniently without bothering to articulate what that motive might even possibly be. Let's all recognize bad-faith arguments, downvote, and move along.)

Re:Why has CPU frequency ceased to grow? (2014) by arbie on Wednesday February 21, 2018 @10:33AM (#16430138)
It does seem a little odd that every comment about Rust gushes about its progress and stability without discussing any downsides. One would be similarly suspicious if, e.g., Perl6 were discussed this way.
Re:Why has CPU frequency ceased to grow? (2014) by gilrain on Wednesday February 21, 2018 @11:05AM (#16430409)
Try it out and write the critique, then. The posts are positive because Rust is genuinely achieving rapid progress and stability... but certainly not without flaws.

I've experienced plenty of frustration, albeit outweighed by the massive benefits for my use case. And there are whole problem domains to which it's just not suited. I see these mentioned pretty frequently.

Re:Why has CPU frequency ceased to grow? (2014) by Thaxll on Wednesday February 21, 2018 @11:45AM (#16430761)
For once there is no consensus how to do parallelism an concurrency in Rust since none of the library are matures.
Re:Why has CPU frequency ceased to grow? (2014) by kibwen on Wednesday February 21, 2018 @04:07PM (#16432982)
> none of the library are matures.

Rayon, the Rust library getting most of the discussion in this thread, is now 1.0: https://github.com/rayon-rs/rayon/blob/master/RELEASES.md .

Re:Why has CPU frequency ceased to grow? (2014) by coldtea on Wednesday February 21, 2018 @12:14PM (#16431007)
Don't most people opt for something called Tokyo? I don't do Rust much, but even I have heard of it by now...
Re:Why has CPU frequency ceased to grow? (2014) by steveklabnik on Wednesday February 21, 2018 @12:25PM (#16431108)
Tokio for IO concurrency, Rayon for data parallelism.
Re:Why has CPU frequency ceased to grow? (2014) by Bitcoin_McPonzi on Wednesday February 21, 2018 @01:17PM (#16431576)
Exactly! Rust doesn't solve any parallelism problems. It's no better than established languages like C# or F#, and probably worse.
Re:Why has CPU frequency ceased to grow? (2014) by vvanders on Wednesday February 21, 2018 @04:02PM (#16432953)
I'd consider handling data races gracefully a pretty large step forward in doing parallel data computation.
Re:Why has CPU frequency ceased to grow? (2014) by coldtea on Wednesday February 21, 2018 @12:13PM (#16430999)
>It does seem a little odd that every comment about Rust gushes about its progress and stability without discussing any downsides.

Doesn't seem odd at all.

First, a lot of people commenting about Rust are enthusiastic recent adopters that haven't seen much of the language, including any real ugly sides yet.

Second, it's not entirely true, almost all Rust threads mention the steep learning curve, the slow compiler, and other issues such as the variadic generics (or lack thereof to be precise).

Third, we have seen the same "early adopter enthusiasts seeing it all rosy" circle for RoR, Go, Node, and Mongo, nothing out of the ordinary here.

Re:Why has CPU frequency ceased to grow? (2014) by chillee on Wednesday February 21, 2018 @11:03AM (#16430389)
That's what happens when you have a new hip language/framework that has a lot of hype.

You see the same with Rust, Elixir, VSCode, Elm, Purescript, ReasonML, etc.

It's not astroturfing, it's just a lot of beginners that are overly excited to proselytize their new discovery.

Re:Why has CPU frequency ceased to grow? (2014) by pault on Wednesday February 21, 2018 @11:24AM (#16430587)
I don't think it's fair to claim these people are all beginners. More likely it's a phenomenon where mature languages have been around long enough that you already know their strong and weak points, but when you look at a language in development you only see its potential.
Re:Why has CPU frequency ceased to grow? (2014) by chillee on Thursday February 22, 2018 @02:20PM (#16440525)
I mean, it's not just true for new languages. For Haskell, you see beginners claim that "it's a perfect language and can do no wrong", while experts in the language will acknowledge its faults, including: long compile times, the downsides of laziness, etc.
Re:Why has CPU frequency ceased to grow? (2014) by BenoitP on Wednesday February 21, 2018 @08:18AM (#16429197)
I'd say exploiting parallelism is not the only way at all. Parallelism is only one way to compute differently. Specialization of hardware to specific workloads will explode in the next years as we can't rely anymore on Moore's law. This will happen on RISC-V, IMHO.

We already have these:

* Rendering, medium precision mathematics: GPU

* Low precision mathematics: TPU

* Software Defined Networking: Microsoft is deploying FPGAs, AWS has its own hardware

We could have:

* Databases: Projections, hashing, sorting in hardware.

* Dynamic runtimes: Hardware implemented memory models, HW assisted GC, code caches and user-level interrupts for the JITs. Here is the J extension RISC-V working group: [1]

etc.

Also, why not have the usual hot paths in Node.js|Spring Framework|Django directly etched into hardware? HW http header parsing surely could bring benefit to them all.

----

Of course language and programmers will have to adapt, but in a lot of cases the runtimes will take care of it automatically.

[1] https://groups.google.com/a/groups.riscv.org/forum/#!msg/hw-...

Re:Why has CPU frequency ceased to grow? (2014) by microcolonel on Wednesday February 21, 2018 @08:29AM (#16429270)
Currently working on software for RISC-V and I can definitely see some opportunities here. One thing that's becoming apparent though, is that some level of abstraction needs to be available in order for many of these things to become useful. RISC-V has a very exciting Vector processing extension, which is intended to replace packed SIMD in most cases, but some software systems assume packed SIMD is the only way to get more FP performance.

For example, WebAssembly specifically exposes SIMD primitives, which means that it may be necessary to work backwards from those SIMD primitives to make use of a true vector machine.

I think many people simply underestimate the cost of adopting a new programming model.

> Also, why not have the usual hot paths in Node.js|Spring Framework|Django directly etched into hardware? HW http header parsing surely could bring benefit to them all.

Well, in all the listed cases here, the CPU is not the bottleneck on throughput. As far as I can tell problem with HTTP is not that headers take too long to parse, it's that memory is still too slow, and context switches cost us precious time. The problem with Node is not that the hardware doesn't adequately model the semantics, it's that dynamic, weak typing makes it hard for any system (software or hardware) to understand what type things are.

Update: The J extension seems interesting, and I've read some research (not thoroughly) recently showing considerable power and time savings from hardware GC primitives. I'm excited to see what goes on in that committee.

Re:Why has CPU frequency ceased to grow? (2014) by BenoitP on Thursday February 22, 2018 @08:12AM (#16437283)
> I'm excited to see what goes on in that committee.

I am too. So far, this post on the general RISC-V mailing list and a few videos online talk about it. I'd love to have some other sources of information on their progress.

Also, I've heard that the RISC-V foundation is actively seeking collaboration for Java. There is some work on having RISC-V backends in HotSpot and JikesRVM, but so far it is limited to interpretation IIRC. The fact that Oracle is not jumping at it and pouring hundred of millions into it is beyond me.

Re:Why has CPU frequency ceased to grow? (2014) by microcolonel on Thursday February 22, 2018 @09:23AM (#16437677)
> There is some work on having RISC-V backends in HotSpot and JikesRVM, but so far it is limited to interpretation IIRC.

Well, JikesRVM is a proper JIT. Palmer Dabbelt from SiFive has worked on a HotSpot port before (for a different platform). I'm currently working on a V8 port. The availability of platform software and language environments is obviously of paramount importance, since it'll shape the remaining first impressions of the architecture.

> The fact that Oracle is not jumping at it and pouring hundred of millions into it is beyond me.

Well, it's a lot of work, and they have their SPARC investment to continue.

Re:Why has CPU frequency ceased to grow? (2014) by rbanffy on Wednesday February 21, 2018 @08:39AM (#16429328)
Still, if you have only two floats to add and make a decision based on the result, a GPU or a TPU will not help you.

Hashing, maybe sorting, blitting and some math could be performed at the on-module DRAM controller level even, without data crossing over the slow DDR4 bus or mangling the CPU caches.

I'd love, in fact, to explore such an architecture in a simulator. What would happen to CPU performance if, say, hashes could be computed without reading the data, memory be cleared without zeroes hitting the bus or some SIMD operations be conducted on the memory.

Edit: clarify the processing could be done on the module side of the memory bus.

Re:Why has CPU frequency ceased to grow? (2014) by saltcured on Wednesday February 21, 2018 @04:27PM (#16433133)
Are you aware of previous work on processor-in-memory architecture research? They considered things like this, but I think it stalled out due to semiconductor process and economic practicality.

This article mostly mentions a UC Berkeley effort: https://en.wikipedia.org/wiki/Computational_RAM

This page mentions others: http://www.ai.mit.edu/projects/aries/course/notes/pim.html

Re:Why has CPU frequency ceased to grow? (2014) by microcolonel on Wednesday February 21, 2018 @09:02AM (#16429461)
> memory be cleared without zeroes

In some specific cases, such as when the Linux kernel maps memory into your process, this is exactly what happens. When you write the page, it faults and clears it on demand; but I don't think there would be a considerable benefit to doing this at a finer granularity.

Re:Why has CPU frequency ceased to grow? (2014) by rbanffy on Wednesday February 21, 2018 @09:45AM (#16429777)
Ideally, you would prefer to postpone the actual writing to memory to the moment the cached version is evicted from on-chip caches. When you write that data to RAM, it'll take a lot of CPU cycles during which even external memory fetches will end up being delayed. And if you want to write all zeros from that page when all you are using are the first 10 bytes, it's a lot of cycles that are going to waste. Being sure the memory was actually zeroed out when you commit those bytes to DDR could save a relatively large time for the memory buses.
Re:Why has CPU frequency ceased to grow? (2014) by jacksmith21006 on Wednesday February 21, 2018 @12:14PM (#16431009)
There is a great paper from Jeff Dean on using the TPUs for more traditional CS functions.

https://research.google.com/pubs/pub46518.html The Case for Learned Index Structures - Research at Google

Re:Why has CPU frequency ceased to grow? (2014) by madez on Wednesday February 21, 2018 @05:45PM (#16433664)
GPU's and Google's TPU's are only capable of certain albeit very important aspects of numerical mathematics. There are other areas of mathematics that have numerical aspects and thus precision, but aren't linear algebra.
Re:Why has CPU frequency ceased to grow? (2014) by skrebbel on Wednesday February 21, 2018 @06:46AM (#16428734)
> Basically the message was that serial performance is saturating, and the only way to get speed improvements in the future is going to be by exploiting parallelism.

People have been warning us about this for about 10 years now, but I still don't see those 64-core CPUs I was promised anywhere.

If we had the amount of parallelism we were told we were going to get, we could give every app its own core. OSes could even consider disabling context switches altogether for the majority of apps. Instead, we're left complaining about Electron apps like it matters.

That said, I'm not sure what stagnation you refer to. There's a reason languages like Rust, Elixir/Erlang and Go are getting popular. My PHP app could handle hundreds of concurrent connections on a single machine, my Elixir app handles hundreds of thousands. Yet, processors didn't get 1000x faster (and Elixir isn't even a particularly fast language). This is the opposite of stagnation, it's progress.

Re:Why has CPU frequency ceased to grow? (2014) by skummetmaelk on Wednesday February 21, 2018 @06:49AM (#16428748)
They have been here for a while, just for a very specific market.

Threadripper and EPYC exist now though. With 32 and 64 logical cores respectively.

Re:Why has CPU frequency ceased to grow? (2014) by skrebbel on Wednesday February 21, 2018 @06:51AM (#16428753)
Sure, there's been high end niche products for anything forever. You could buy a 64 core computer in 1990 (they'd call it a supercomputer, but same thing).

The people telling us we had to go change our code to use parallel processing fast predicted a significantly faster increase in amount-of-cores on commodity hardware. Instead, CPUs stopped getting faster and hardly gained more parallellism.

Re:Why has CPU frequency ceased to grow? (2014) by pdpi on Wednesday February 21, 2018 @07:12AM (#16428845)
You could buy a 64 processor machine in 1990, but it wouldn’t have been a 64 core machine in the sense we’re talking about — a single socket system. This isn’t some trivial distinction either, as the whole memory architecture is very different indeed for the two scenarios.
Re:Why has CPU frequency ceased to grow? (2014) by makomk on Wednesday February 21, 2018 @08:27AM (#16429261)
Even in single-socket configurations, Threadripper and EPYC are still both NUMA architectures - the cores are split across two or four dies, each of which has its own memory controller and memory attached to it, with requests from a core to memory on another die going via an interconnect.
Re:Why has CPU frequency ceased to grow? (2014) by wmf on Wednesday February 21, 2018 @02:14PM (#16432055)
those 64-core CPUs I was promised

The people promising that were crackpots and no one really called them out on it, so that meme got repeated everywhere despite being wrong. Processor vendors can't release a new processor that runs existing apps slower because no one would buy it (not counting monopolistic tactics). And since many existing apps are single-threaded, that means new processors have to at least maintain the same single-threaded performance which means keeping brainiac cores which means you can only afford 6-8 of them. (And arguably there are 64 weak cores in your CPU; they're just in the IGP and you have to program them with OpenCL.)

Go/Rust/Elixir are not so much progress IMO as undoing the negative progress of writing large-scale software in scripting languages.

Re:Why has CPU frequency ceased to grow? (2014) by marcosdumay on Wednesday February 21, 2018 @06:53AM (#16428760)
There are plenty of 64 cores servers. Yet, multi-core architectures seem to have hit a wall caused by slow memory access.

I'm still waiting for the massively parallel NUMA machine in a chip, but there are many manufacturing problems keeping those away.

Re:Why has CPU frequency ceased to grow? (2014) by monocasa on Wednesday February 21, 2018 @08:20AM (#16429209)
And hit a wall for power/density.

https://en.wikipedia.org/wiki/Dark_silicon

Re:Why has CPU frequency ceased to grow? (2014) by pjc50 on Wednesday February 21, 2018 @07:05AM (#16428807)
If you can find an Nvidia GTX 1080, that has 2560 cores.
Re:Why has CPU frequency ceased to grow? (2014) by monocasa on Wednesday February 21, 2018 @08:18AM (#16429195)
They're playing games with the term 'core'.

In CPU terms, a 1080 is 40 cores, each with a 64 way vector unit.

Re:Why has CPU frequency ceased to grow? (2014) by Maybestring on Wednesday February 21, 2018 @09:58AM (#16429870)
I'm surprised they don't sell it as a 40 core, 64-dimensional processor.
Re:Why has CPU frequency ceased to grow? (2014) by kale on Wednesday February 21, 2018 @07:40AM (#16428992)
Without branching (or with limited branching, last I checked it masked and re-ran instead). A core implies both instruction and data operations, rather than SIMD behavior.
Re:Why has CPU frequency ceased to grow? (2014) by deepnotderp on Wednesday February 21, 2018 @01:51PM (#16431878)
Where "core" ~= vector lane
Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Wednesday February 21, 2018 @04:44AM (#16428195)
https://golang.org/

In case you dont know, Golang goroutines are a marvel of parallelism. They are coroutines which are dispatched on a few OS threads. So you can use 100% of a multi-cores CPU and yet, spawn, say, 10K of those light threads without worrying about context switches PLUS have them all run concurrently. I've found that golang is one of those rare language, like Lisp, that actually change the way you think about programming. Makes you feel really more powerful.

If you dont know that language, I suggest to run the following and watch your cpu activity and memory (or any metric):

  import "time"
  func main() {
    for i := 0; i < 10000; i++ { 
      go func() { 
        for { 
          time.Sleep(time.Second) 
        }
      }() 
    }
  }
Re:Why has CPU frequency ceased to grow? (2014) by magnetic on Wednesday February 21, 2018 @11:57AM (#16430851)
In my experience the facilities to throw tasks into a scheduler that will run them in parallel was never the hard thing to accomplish (regardless of the language: some may have built-in capabilities, others may have syntactic sugar provided by a lib, but at the end of the day, most systems provide some kind of runTask(f) method).

What's really hard is to break down a problem into parallelizable chunks, figure out as much independent work as possible to reduce the touchpoints, and coordinate all those tasks such that they keep the CPU as busy as possible and as a whole finish as early as possible.

Beyond this "parallel breakdown design", it's the little touchpoints with shared data structures and synchronization that creates the difficulty of implementation, and I haven't seen any language or system that does magic there.

Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Thursday February 22, 2018 @02:10AM (#16435789)
throw tasks into a scheduler that will run them in parallel was never the hard thing to accomplish

Common mistake number 1. Goroutines are running in parallel AND concurrently - they are coroutines (common mistake number 2 is to think they are only coroutines). I suggest not to underestimate that, it's the big deal. Additionnaly, it's important to note that goroutines yields on sleeps (any kind of sleeps / waits, like disk reads, network requests, channel writes/reads, etc), and while it may sound like a detail, it's a wonder of cpu control. Due to that, there is also a rare elegance to the way Go solve sharing data via channels.

What's really hard is to break down a problem into parallelizable chunks, figure out as much independent work as possible to reduce the touchpoints, and coordinate all those tasks such that they keep the CPU as busy as possible and as a whole finish as early as possible.

That's exactly what Go is a wonder for due to the combination of parallelism, concurrency, yield-on-sleep and channels.

Re:Why has CPU frequency ceased to grow? (2014) by dx034 on Wednesday February 21, 2018 @08:21AM (#16429213)
And yet, Go's standard map doesn't allow concurrent access. They recently added a concurrent map feature but it's probably easier to add a lock to your code than refactoring it with the new map type. I would've preferred if they had introduced a map type that can be used exactly as the standard one (i.e. without function calls). Calling functions via go func() is really easy but handling data between goroutines can still cause headaches and is something that could be improved.
Re:Why has CPU frequency ceased to grow? (2014) by ta2384428 on Wednesday February 21, 2018 @09:15AM (#16429547)
If you squint a little, you'll notice that go is pretty big on not hiding complexity. There are obvious exceptions to this such as the garbage collector, and heap/stack control.

I'm unsure if the intent of not including a map function was due to this, however with a for loop such as

    for x := range ch {
       slice = append(slice, x)
    }

, it is immediately obvious there are allocations happening in the background.

The fact that map access, and slice access is not thread safe means there is no trickery going on in the background. The fact that it is not threadsafe means I don't need to worry about a lock if I only write to a map when it's created. Sure the compiler could take care of this - they have the race detector after all, but the compile speed is one of the design goals of go. I really like being able to compile in less than 1 second.

`sync.Map` however calls a function which implies there is more going on in the background.

If you follow the go mantra of share memory by communicate, don't communicate by sharing memory - handling data becomes a whole lot easier. It does allow you to share memory in case you do need the extra speed.

Like most things, all designs are a matter of trade offs. Sacrifice one thing for another. There are other languages that provide the functionality you desire - but I understand the frustration when one thing is 90% what you want.

Go obviously has room for improvement, and perhaps a native threadsafe map is one of those areas.

Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Wednesday February 21, 2018 @10:23AM (#16430056)
Well, go isn't really a high-level language which maps can be seen as a feature of. The idea behind go, I believe, is to focus and provide innovative system-level features.
Re:Why has CPU frequency ceased to grow? (2014) by eropple on Wednesday February 21, 2018 @02:27PM (#16432184)
Go is not a language for "system-level features" in the first place. Its garbage collector largely precludes it from that in any modern context.

That it can't do something effectively does not mean that it shouldn't or didn't mean to. (And users can't really fix it, because hey, no generics. Sigh.)

Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Thursday February 22, 2018 @02:29AM (#16435857)
Go is not a language for "system-level features" in the first place. Its garbage collector largely precludes it from that in any modern context.

I'm pretty sure I disagree with that largely because Go is low-level enough so that the GC is easily handled.

And users can't really fix it, because hey, no generics. Sigh.

Users can fix it by writing languages on top of Go (particularly dynamic ones).

Re:Why has CPU frequency ceased to grow? (2014) by Const-me on Wednesday February 21, 2018 @09:30PM (#16434746)
> golang is one of those rare language

Not sure how rare, .NET does that as well. Below is your sample translated to C#. It requires C# 7.1 because async main, but the rest of the stuff is available for many years, since 2010.

    static async Task routine()
    {
        await Task.Delay(TimeSpan.FromSeconds(1));
    }

    static Task Main()
    {
        return Task.WhenAll(Enumerable.Range(0, 1000).Select(i => routine()));
    }
Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Thursday February 22, 2018 @02:37AM (#16435901)
It's unclear to me if these parallel tasks are also coroutines (there seems to be a call to yield but its unclear what it really does), and if they yield on any sleeps which is a key features of goroutines.
Re:Why has CPU frequency ceased to grow? (2014) by Const-me on Thursday February 22, 2018 @04:17AM (#16436327)
> if these parallel tasks are also coroutines

I don’t have hands-on experience with golang but based on what I know about it yes, they are.

> there seems to be a call to yield but its unclear what it really does

You mean “await”?

It waits for the completion of whatever is on the right side of “await”. If the result is already available, it just continues. If the result is not yet available (e.g. Task.Delay creates a task that will complete in some moment in the future), the control goes away from the async method to the scheduler. The scheduler can then run some other task on the same OS thread. When the result of that operation becomes available (in the sample code, when 1 second delay passes), the scheduler resumes execution of that async method, on the statement after the await.

> if they yield on any sleeps

No, not any sleep. You can call Thread.Sleep() which will put the whole OS thread to sleep. It’s up to programmers to avoid calling blocking APIs from their async methods, i.e. use await Task.Delay() instead of Thread.Sleep(), await stream.ReadAsync() instead of stream.Read(), and so on.

Re:Why has CPU frequency ceased to grow? (2014) by brobinson on Wednesday February 21, 2018 @08:16PM (#16434420)
>marvel of parallelism

If Go's m:n is blowing your mind, you should check out Erlang. Spawning a million "processes" is not a big deal.

Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Thursday February 22, 2018 @02:31AM (#16435867)
Cool, thanks for the suggestion.
Re:Why has CPU frequency ceased to grow? (2014) by VHRanger on Wednesday February 21, 2018 @07:48AM (#16429037)
How is that an example an improvement over c++? C++ has had pragmatic omp parallel for for two decades
Re:Why has CPU frequency ceased to grow? (2014) by ta2384428 on Wednesday February 21, 2018 @08:48AM (#16429377)
I'm not familiar with OMP, so please forgive me if I'm incorrect - but OMP from my quick search appears to be thread based, while go routines are much lighter weight than threads. They have their own scheduler - which like most things is both good and bad depending on what you want them for. If you use them as intended, the internal scheduler is a great design decision. This means I can happily spawn 10,000 without concern.

Additionally, combining them with the power of channels makes quick work of many tasks. Channels of course can be implemented in C++ too, but having the compiler take care of it for you with additional tools such as the race detector is very handy.

For a large set of problems, they are very nice to work with.

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @10:21AM (#16430043)
You can do the same in C++ on Windows with PPL, UNIX/Windows with Intel TBB, or any of the fiber/co-routine libraries.

Then there is the ongoing work to add async/await patterns into C++20.

Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Wednesday February 21, 2018 @10:34AM (#16430143)
As a matter of fact, you can do the same in assembly if you want to.

Notice how you can always have that answer when it comes to programming languages: you can do the same in. The point is that, the way it's made in go, is awfully handy.

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @11:52AM (#16430823)
I hardly see a difference from

    go func () { }
and

    Task.Run(() => { })
With the benefit that on the latter example, the runtime allows me to customise how scheduling is done.
Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Thursday February 22, 2018 @02:52AM (#16435980)
Are those Tasks coroutines? If yes, do they yield on any sleeps?

These aspects are key to goroutines.

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Thursday February 22, 2018 @03:43AM (#16436175)
Yes they do, they are the building blocks for async/await, get a thread allocated from a thread pool when running, and you can control how the scheduling takes place, by providing your own scheduler implementation.
Re:Why has CPU frequency ceased to grow? (2014) by ta2384428 on Thursday February 22, 2018 @08:54AM (#16437520)
That is pretty cool, C++ has come a long way since I used it last about 15 years ago.

It seems like both languages are equally capable here, with C++ having more power and foot guns when required as usual.

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Thursday February 22, 2018 @01:25PM (#16439937)
The code snippet example I wrote was actually .NET with TPL.

C++ with PPL on Windows, would be

    task<T> handle = create_task([] { /* ... */ });
And with standard C++

    future<T> handle = std::async(std::launch::async, [] { /* ... */ });
In both cases, with C++20 it will be possible to co_await handle, which you can already play with on clang and VC++.
Re:Why has CPU frequency ceased to grow? (2014) by creato on Wednesday February 21, 2018 @10:59AM (#16430350)
Every OpenMP implementation I know of uses a thread pool, and dispatches parallel work to it.

This is probably exactly the same behavior as goroutines.

Re:Why has CPU frequency ceased to grow? (2014) by Const-me on Wednesday February 21, 2018 @09:45PM (#16434788)
OMP is only good for CPU bound code. You try to do IO inside OMP parallel section, and you’ll put the whole OS thread to sleep. The OS kernel will likely reschedule some other thread on that hardware thread, but that rescheduling is an expensive process.

Goroutines and .net tasks allow a nice mix of CPU bound and IO bound code. While a goroutine/task is waiting for IO or something else to complete (timer in this example), the runtime will immediately use the hardware thread for some other task, without OS involved.

Re:Why has CPU frequency ceased to grow? (2014) by tzahola on Wednesday February 21, 2018 @05:30AM (#16428423)
Your example will not run in parallel. The go runtime will schedule your goroutines concurrently, but they will be run by a single OS thread, and consequently on a single CPU core.

Once you execute truly on multiple CPU cores (by increasing GOMAXPROCS), you'll be having the same kind of race conditions in Go as in any other imperative language (inb4 Rust Evangelism Strike Force saying "except Rust").

Re:Why has CPU frequency ceased to grow? (2014) by boomlinde on Wednesday February 21, 2018 @06:02AM (#16428575)
> Once you execute truly on multiple CPU cores (by increasing GOMAXPROCS), you'll be having the same kind of race conditions in Go as in any other imperative language (inb4 Rust Evangelism Strike Force saying "except Rust").

Wrong. GOMAXPROCS defaults to the number of logical CPUs, IIRC since version 1.5. For example, I have four cores with 2 threads each, so goroutines will be executed on up to 8 threads unless I set GOMAXPROCS to something else or the application explicitly changes it using the runtime package.

And sure, you'll really have the same problems, but IMO channels and goroutines minimize the friction of implementing thread safe programs using CSP. GP seems a bit optimistic, agreed, but I think that there is at least some substance to the idea that go makes it easier to correctly utilize multiple cores.

Re:Why has CPU frequency ceased to grow? (2014) by zxcmx on Wednesday February 21, 2018 @05:42AM (#16428483)
GOMAXPROCS has defaulted to # of cores since 1.5.
Re:Why has CPU frequency ceased to grow? (2014) by quadcore on Wednesday February 21, 2018 @05:37AM (#16428453)
Wrong. Goroutines are not simply coroutines.

GOMAXPROCS defaults to number of cores.

Re:Why has CPU frequency ceased to grow? (2014) by tzahola on Wednesday February 21, 2018 @05:39AM (#16428466)
Prove it.

Prove it by replacing Sleep in your example with some number crunching, and show how it scales with the number of cores in your CPU.

Re:Why has CPU frequency ceased to grow? (2014) by ta2384428 on Wednesday February 21, 2018 @08:57AM (#16429427)
https://imgur.com/a/DNpw3

Running the following code.

https://play.golang.org/p/k_rRxNAyb0i

I can assure you that go runs across all processors by default.

https://docs.google.com/document/d/1At2Ls5_fhJQ59kDK2DFVhFu3...

Re:Why has CPU frequency ceased to grow? (2014) by grkvlt on Saturday February 24, 2018 @10:36AM (#16453649)
That's not what he's saying. He knows go can use all processors if GOMAXPROCS is set correctly, the argument seems to be that there will be race conditions just like any other threading, which seems pretty self evident to me: yes, multi-threaded code can have concurrency issues, film at 11...
Re:Why has CPU frequency ceased to grow? (2014) by gall0ws on Wednesday February 21, 2018 @06:00AM (#16428567)
Re:Why has CPU frequency ceased to grow? (2014) by gameswithgo on Wednesday February 21, 2018 @11:00AM (#16430357)
Dude you are wrong about this. Please stop.
Re:Why has CPU frequency ceased to grow? (2014) by iknowstuff on Wednesday February 21, 2018 @11:04PM (#16435071)
Except Rust!
Re:Why has CPU frequency ceased to grow? (2014) by jokoon on Wednesday February 21, 2018 @05:01AM (#16428299)
I wonder if the future will be massively parallel, when CUDA and opencl came out I thought that future processors would have more and more core, so if you follow Moore's law, CPUs would see their core count double each 6 months. The problem is that GPU don't have error correcting codes, so you cannot really run application code on a GPU.

The problem with parallelism is that C-like language don't fit well, only functional languages do. If you want to use multi-threading you have to forget about state and only work with input/output paradigms. For OSes it might mean a deep re-design, but I don't really know.

A possible design would be a small but very fast CPU that only takes care or scheduling and task control, and another chip with many cores that deal with payloads and user software.

AMD had some kind of hybrid chip that planned to do both graphics and task, but it was thrown away.

Going parallel would require to change both hardware and software, and by software I mean stateless.

Re:Why has CPU frequency ceased to grow? (2014) by zmonx on Wednesday February 21, 2018 @05:22AM (#16428383)
These are very good points! I would generalize "functional" to declarative though:

Logic programming languages like Prolog and Mercury are also much more amenable to parallelization than C-like languages.

In fact, different Prolog clauses could in principle be executed in parallel without changing the declarative meaning of the program, at least as long as you stay in the so-called pure subset of the language which imposes certain restrictions on the code.

Re:Why has CPU frequency ceased to grow? (2014) by pjc50 on Wednesday February 21, 2018 @09:08AM (#16429508)
> The problem is that GPU don't have error correcting codes

.. eh? What are you referring to here? Mainstream CPUs don't have error correction either, unless you're talking about ECC on the higher-end ones.

Re:Why has CPU frequency ceased to grow? (2014) by versteegen on Thursday February 22, 2018 @04:56AM (#16436487)
Actually, mainstream CPUs do use error detection and correction for internal operations and memory.

https://en.wikipedia.org/wiki/Machine-check_exception

Realise that if you only protected RAM with ECC then you're leaving a lot of data vulnerable in caches and registers, so those need parity bits too (as well as lots of other error checks on CPU operations). And anyway, CPU errors are common due to bad power supplies and overclockers. And you don't want to add a whole lot of design effort to create a marginally cheaper-to-produce version of the CPU which doesn't do any error checking.

I've seen a lot of MCEs on non-ECC CPUs :(

IANAEE

Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:08AM (#16428830)
I always like to think of FP dataflow pipelines as doing digital circuits modeling.
Re:Why has CPU frequency ceased to grow? (2014) by seanmcdirmid on Wednesday February 21, 2018 @10:08AM (#16429937)
The first GPU models were basically stateless (via pixel and vertex shaders with texture input and outputs), but this was incredibly inefficient for many GPGPU tasks, so compute shaders and CUDA have ways to load from and store to arrays. The memory model is a bit funky, but I’m not sure how going back to functional is viable for GPU programming.
Re:Why has CPU frequency ceased to grow? (2014) by tzahola on Wednesday February 21, 2018 @05:24AM (#16428396)
Intel Larrabee also got cancelled.
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:07AM (#16428823)
Kind of, it became Xeon Phi.
Re:Why has CPU frequency ceased to grow? (2014) by otabdeveloper1 on Wednesday February 21, 2018 @06:57AM (#16428780)
I'm surprised that there hasn't emerged a "parallel-by-default C++" kind of language + hardware system to exploit it to keep things going forward.

There has. GPU programming is exactly that. CPU-heavy tasks (games, bitcoin mining, machine learning) have already migrated.

Re:Why has CPU frequency ceased to grow? (2014) by pjc50 on Wednesday February 21, 2018 @05:52AM (#16428533)
Unfortunately it requires more than just a change of language, it requires a change in mode of thinking by developers. People are very used to reasoning in terms of "do X, then Y, then Z" or "compute a value X then do A or B on the basis of that". In order to achieve automatic parallelism you need e.g. a type+proof system that can determine that X/Y/Z are independent, or a system that can partially execute both A and B then retire the branch not taken - without invoking security bugs!
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:12AM (#16428847)
I think it is easier to understand by those of us that also had electronic design as part of the engineering degree.
Re:Why has CPU frequency ceased to grow? (2014) by UncleSlacky on Wednesday February 21, 2018 @06:17AM (#16428633)
This issue was discussed in my Occam class ~28 years ago. Occam itself is an example of a concurrent/"parallel-by-default" programming language intended for a Transputer hardware environment (now retargetable to x86 etc.), but it's not the easiest of languages to learn:

https://en.wikipedia.org/wiki/Occam_(programming_language)

https://en.wikipedia.org/wiki/Transputer

https://en.wikipedia.org/wiki/KRoC

Re:Why has CPU frequency ceased to grow? (2014) by Pica_soO on Wednesday February 21, 2018 @05:47AM (#16428510)
The sequential programming by default is because most people think sequential by default.

Even though claims of multi-tasking etc persist, the truth is good parallel programmers are a rare thing.

Many ordinary programmers already get into Hot-Water when they use two threads and access data where a Semaphore might be needed.

In addition many algorithms are sequential, so parallelizing them is tricky or gives you no true reward due to cross-thread communication. Add to that the OO-Software Structures that subtle encourage using sequential programming.

I think the future in parallel-programming is actually hiding the parallel programming completely - accept the fact that most humans are not made for it, allow for experts to unlock the ability to override that behavior- let compilers go as far as they can and live with the results.

It will suffer the same fate as functional programming. Really useful, but never dominant, due to limitations in the applying humans.

Re:Why has CPU frequency ceased to grow? (2014) by blauditore on Wednesday February 21, 2018 @05:11AM (#16428344)
I think part of the reason why many programmers haven't wanted to deal with parallel execution is because concurrency is not easy to handle. It has several pitfalls and can be painful to debug. Also, it needs proactive efforts implementing it, so as long as not required, devs just stick to serial execution.

Now, with helpful systems like no-side-effect functional languages and reactive stream frameworks, a lot of gory detail can be abstracted away. I think this has recently lead to more parallel-by-default software development.

Re:Why has CPU frequency ceased to grow? (2014) by adrianN on Wednesday February 21, 2018 @05:32AM (#16428432)
Most software is fast enough when written in a naive sequential style. For the parts that parallelize well and matter, there are already decently mature ways of using all cores. Languages like Go, Rust, and Erlang make it fairly easy to write concurrent programs.
Re:Why has CPU frequency ceased to grow? (2014) by MichaelMoser123 on Wednesday February 21, 2018 @05:54AM (#16428545)
> However, most programmers, and programming languages, remain stuck in a serial-by-default paradigm

You still have to decide upon the unit of work that is going to be sent to a different thread/core/processor/NUMA node/whatever. The different units of work that are distributed should not share state; one really doesn't want to be sharing a lot of state between different processors, because synchronizing the processors memory caches in NUMA is a extremely slow.

I guess it is really hard to break up both the program and data and decide upon the optimal granularity of the work units, it is not something that can be easily done behind the scenes - human intervention is still required.

Re:Why has CPU frequency ceased to grow? (2014) by jonathanstrange on Wednesday February 21, 2018 @07:02AM (#16428797)
I agree, programming languages have not caught up yet.

The right kind of language looks at serial program formulations and based on flow-analysis automatically identifies parallelizable fragments that are large enough to benefit from multicore, then schedules these fragments e.g. by using work-stealing in a system of green threads, i.e., mapping green threads to OS cores as efficiently as possible. Something like that.

In a good parallel language there need to be many immutable constructs by default, exception handling is tricky, and ordinary flow control needs to be compatible by default with parallel evaluation. The languages I've seen such as Parasail are not yet production ready.

Making the programmer control parallelism can be okay, like in Go and Ada, but in the end it should be automatic.

Edit: The problem is also that finding a neat way of solving the problem academically does not readily translate into an efficient implementation, so much that I wonder whether green threads are actually worth it over OS threads. In most languages/VMs they aren't but Go seems to be an exception.

Re:Why has CPU frequency ceased to grow? (2014) by Santosh83 on Wednesday February 21, 2018 @06:09AM (#16428601)
One reason is that our thinking process is inherently serial and we do really badly at multitasking naturally. At least those involving deliberate thought. And our programs are almost an extension of our way of thinking, so we will have to push the boundaries of how we think and model systems in our mind before we can build excellent parallel programming languages. Not that it isn't being done, but the weight of the "serial" legacy is long...
Re:Why has CPU frequency ceased to grow? (2014) by monocasa on Wednesday February 21, 2018 @06:16AM (#16428630)
It's not just our thought process; there are upper limits to the gains from increased parallelism.

https://en.wikipedia.org/wiki/Amdahl%27s_law

Re:Why has CPU frequency ceased to grow? (2014) by dragontamer on Wednesday February 21, 2018 @09:48AM (#16429797)
> I'm surprised that there hasn't emerged a "parallel-by-default C++" kind of language + hardware system to exploit it to keep things going forward.

CUDA. OpenCL. Vulkan Compute Shaders. DirectCompute. C++ AMP. AMD's ROCm. Intel's SPMD. Khronos SYCL.

Re:Why has CPU frequency ceased to grow? (2014) by tomc1985 on Wednesday February 21, 2018 @02:09PM (#16432021)
This argument made sense 10 years ago. We've had dual cores for more than a decade, and CPU speeds stopped growing years ago. If you still can't think in threads and their primitives, or require crutches to handle multithreaded situations, then the problem is with you.
Re:Why has CPU frequency ceased to grow? (2014) by 0xcde4c3db on Wednesday February 21, 2018 @09:51AM (#16429811)
Beyond the issues of languages and mindset, many problem domains parallelize poorly. Too many important phenomena fundamentally involve feedback loops evolving over time, and when that happens you can't just compute f(t) and f(t + 1) on different cores. At that point, throwing more cores at the problem might let you make the model bigger, but will very quickly hit a wall in terms of making it faster.
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @04:48AM (#16428224)
A few attempts have already been done, the issue is with developer adoption, not lack of trying.

One of the best examples was StarLisp for the Connection Machine.

Re:Why has CPU frequency ceased to grow? (2014) by convolvatron on Wednesday February 21, 2018 @11:57PM (#16435243)
starlisp required that you rephrased your problem to be large vector, with support for turning off logical cpus, very much like programming a modern gpu. if your problem could be recast that way it was pretty nice. however the generalized scatter/gather was so expensive, it had to be used very sparingly. you had to use the grey coded nearest neighbor hypercube network as much as possible.

the really* cool language from Hillis and Steele was cmlisp, but I don't know how far they got, they never released anything.

Re:Why has CPU frequency ceased to grow? (2014) by ajross on Wednesday February 21, 2018 @11:05AM (#16430414)
> I'm surprised that there hasn't emerged a "parallel-by-default C++" kind of language + hardware system

There has. It's called a GPU. Things like OpenCL and CUDA are the new languages.

Re:Why has CPU frequency ceased to grow? (2014) by vvanders on Wednesday February 21, 2018 @11:15AM (#16430505)
Yeah, the tricky bit is it's not just a new language but also laying out your data in a new way that compatible with vectorization/etc. Modern OO/etc techniques love to litter pointers to random places in memory at nearly every step.

It's partly what made the PS3 so hard to write for, the SPUs only have 256kb of directly addressable memory, everything else is DMA'd. That said when you had your code+data fitting in 256kb it screamed everywhere else as well since you fit in L1+L2 cache neatly.

Re:Why has CPU frequency ceased to grow? (2014) by fulafel on Wednesday February 21, 2018 @11:15AM (#16430508)
But it would be much better if a single language + hardware system emerged, rather than a multitude of mutually incompatible hardware systems and languages.

With the current fragmented and sometimes proprietary forest of programming platforms, an application needs to be quite specialized to warrant investment in GPU compute outside the original niche of graphics acceleration. There are other giant problems too, after you get over rewriting your application for numerous different platforms - atrocious quality of GPU drivers causing OS crashes for users, lack of any common way to debug GPU code, the colourful quality of compilers, the wildly different performance characteristics of different platforms necessitating per-platform algorithm changes, etc...

Consider what a minority of applications bother to even put in the work to exploit large amounts of CPU parallelism, which is vastly easier. There is after all >10x parallelism available on a typical PC CPU, after you count cores, threads and SIMD lanes.

Re:Why has CPU frequency ceased to grow? (2014) by ajross on Wednesday February 21, 2018 @01:02PM (#16431461)
> But it would be much better if a single language + hardware system emerged

There will, but it takes time. The world of scalar hardware in the 1970's was no less fragmented. Honestly most of the incompatibilities in the SIMD world at this point are bugs and not fundamental problems. The vector world has settled on a broad architecture at this point for most things.

Re:Why has CPU frequency ceased to grow? (2014) by fulafel on Thursday February 22, 2018 @12:43AM (#16435384)
Maybe. I feel is's at least equally likely that app dev perceived ROI on GPGPU will get worse due to relative slowdown in GPU advances and increasing parallel programming productivity on CPUs, and an attractive GPGPU platform won't emerge before it's irrelevant.
Re:Why has CPU frequency ceased to grow? (2014) by Androider on Wednesday February 21, 2018 @08:21AM (#16429220)
With just Chrome and IntelliJ running on Ubuntu, I have 281 processes and kernel workers running (as reported by ps). Just stitching the apps together for display on your screen requires 3-4 different processes (and a GPU). That's why 4 logical cores is a bare minimum these days for a desktop, even if no individual application takes advantage of more than a single core.

On the server side, when we deploy a Node.js web service on AWS we start one instance per logical core, for 4-64 processes all independently serving connections.

It seems the process has become the new thread, the smallest unit you should design for. So today's workloads actually make pretty good use of all those cores. Unless you're doing high performance computing and need to squeeze every last drop of performance, processes are a straightforward way to parallelize.

Re:Why has CPU frequency ceased to grow? (2014) by rbanffy on Wednesday February 21, 2018 @09:09AM (#16429519)
Having 281 processes is not a biggie. Having 281 processes that can actually use a piece of the CPUs is quite a different thing.

I think we should, really, start thinking about such things. Maybe prefixing instructions with the execution unit that should handle them (and overflow back to the first one in a circle if we have more EU's in software than the actual hardware provides), separating dependencies within code flow in a more explicit way and, at the same time, not bothering with creating threads.

Re:Why has CPU frequency ceased to grow? (2014) by quietbritishjim on Wednesday February 21, 2018 @08:28AM (#16429263)
One option is that you write in a high-level language where the top-level control code is single threaded, but you call APIs that perform multi-threaded operations seamlessly. The prototypical example of this is Python with numpy/blas (or with deep learning libraries like TensorFlow).
Re:Why has CPU frequency ceased to grow? (2014) by Sean1708 on Wednesday February 21, 2018 @05:26AM (#16428406)
Chapel[0] and Fortress[1] come to mind. Wikipedia also has a list of parallel programming languages[2] (although it seems to play somewhat fast and loose with the definition of "parallel programming language").

[0]: https://en.wikipedia.org/wiki/Chapel_(programming_language)

[1]: https://en.wikipedia.org/wiki/Fortress_(programming_language...

[2]: https://en.wikipedia.org/wiki/List_of_concurrent_and_paralle...

Re:Why has CPU frequency ceased to grow? (2014) by z3t4 on Wednesday February 21, 2018 @06:01AM (#16428569)
I think JavaScript is nice because it's async in nature. Concurrency is hard so it's nice to deal with it using a simple language, so that everything besides the business logic is abstracted. Yes you do not get the same performance, but CPU cores are relatively cheap compared to engineer salaries.
Re:Why has CPU frequency ceased to grow? (2014) by pdpi on Wednesday February 21, 2018 @07:23AM (#16428905)
The notion that cpu cores are cheap compared to engineer salaries only scales so far.

Scaling upwards, your opinion on that changes when a single engineer’s service is running on 10k machines.

At the other end of the spectrum, if you’re developing high-performance applications for small systems (desktop, laptops, mobile), Your workload isn’t going to look like tens of thousands of concurrent independent requests, So the approach of getting parallelism by deploying multiple copies of the application no longer works

Re:Why has CPU frequency ceased to grow? (2014) by dx034 on Wednesday February 21, 2018 @08:25AM (#16429244)
> but CPU cores are relatively cheap compared to engineer salaries

I often experienced that this backfired. Single machines are still constrained in their power and while it's easy to spin up additional VMs in the cloud, scaling a program properly to run on dozens of machines takes a lot of work. It can be faster to develop a program that is really efficient and can solve the problem on one machine than to develop faster only to then spend the time scaling it to a large fleet of servers.

Re:Why has CPU frequency ceased to grow? (2014) by z3t4 on Wednesday February 21, 2018 @10:30AM (#16430099)
I kinda regret adding the note about performance, because switching to a lower level language used to yield orders of magnitude more performance, but optimizers have evolved and today there's not much difference. Sometimes the higher level language will be even faster because of optimizations. And bad performance is often not to blame on the language, instead blame the programmer or more likely the business people as they think it's great to waste resources as it gives them an excuse to charge more.
Re:Why has CPU frequency ceased to grow? (2014) by ska on Wednesday February 21, 2018 @04:13PM (#16433019)

   used to yield orders of magnitude more performance, but optimizers have evolved and today there's not much difference.
If this were true, you'd expect see a lot more native python and the like.
Re:Why has CPU frequency ceased to grow? (2014) by deepnotderp on Wednesday February 21, 2018 @08:34PM (#16434503)
Python is interpreted so super optimizing compilers, SIMD auto vectorization and other recent goodies necessary to get that performance won't work.
Re:Why has CPU frequency ceased to grow? (2014) by ska on Wednesday March 07, 2018 @04:57PM (#16540311)
Python is not always interpreted. And when it isn't, it's still slow.
Re:Why has CPU frequency ceased to grow? (2014) by PaulHoule on Wednesday February 21, 2018 @08:32AM (#16429290)
Materials other than silicon can support higher clock rates.

From reading the open literature and advertisements by foundry companies, I think you could make a 6502 equivalent processor with Indium Phosphide with 64kb of static RAM that clocks at 30 GHz. With a more refined process you might push 90 GHz and a much more complex processor.

Yes, InP is more expensive than Silicon but part of that is the low volume that InP parts are made in. Advances in Silicon are getting much more expensive, and one InP microprocessor could do the work of ten Silicon-based cores so you can save on die area without the "race to the bottom" in size.

The main issue with high clocks is fast access to memory, probably you would need an optical interface to off-chip RAM, also I don't know what the InP equivalent of DRAM is. (Something like Optane?)

Re:Why has CPU frequency ceased to grow? (2014) by deepnotderp on Wednesday February 21, 2018 @04:21PM (#16433077)
1. Compound semiconductors often suffer from p-type and n-type conduction problems. Plus they're ridiculously expensive and power hungry. They also often lack a native oxide.

2. The problem today in CPUs is not really clock speed but much more the memory access latency, optane is much slower* than DRAM and has much lower endurance.

*Even though silicon HKMG transistors use high k gate dielectrics now, they still use a silicon dioxide interfacial layer.

Re:Why has CPU frequency ceased to grow? (2014) by nikofeyn on Wednesday February 21, 2018 @09:41AM (#16429750)
> I'm surprised that there hasn't emerged a "parallel-by-default C++" kind of language + hardware system to exploit it to keep things going forward.

there has and it's called labview, although by hardware you may have meant processors. labview has many quirks, but it surprisingly gets many things right, even in futuristic ways. when i move back to text-based languages it's always a jolt primarily due to the serial nature of them, even those that support asynchronous computation. it's really hard to recalibrate to having to assign things to temporary variables and the like. and the lower dimensions of a text file compared to a higher dimensional canvas is something that sticks out as a limiting factor in supporting parallel by default.

> I find the apparent stagnation extremely depressing.

agreed.

Re:Why has CPU frequency ceased to grow? (2014) by tbrock on Wednesday February 21, 2018 @09:51AM (#16429814)
Golangs’s web server, by default serves every request in a new goroutine (thread of execution) making it parallel by default with no effort on the user’s behalf.

Obviously this problem domain is easily parallelized but it’s nice to see parallelism be the refs to standard when possible and reasonable to do so.

Re:Why has CPU frequency ceased to grow? (2014) by ninkendo on Wednesday February 21, 2018 @07:01PM (#16434075)
Just to be clear, goroutines aren't threads (although they are multiplexed onto threads), and they're only pre-empted at certain points in the go runtime (function calls are the big ones.)

If your request spins in a for-loop doing lots of work without function calls, other goroutines on the same thread won't get a chance to run, and you'll be limited to GOMAXPROCS simultaneous requests. In practice this never really happens though.

Re:Why has CPU frequency ceased to grow? (2014) by kbart on Wednesday February 21, 2018 @05:19AM (#16428374)
While modern languages support for parallelism is adequate, tools are still lacking imho. I avoid parallelism when it's not necessarily, because debugging all these race conditions, deadlocks, synchronization etc. is a nightmare.
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @05:44AM (#16428493)
That is mostly an issue with the "avoid IDE" crowd.

While IDE tooling can still be improved, the parallel debugging tools in .NET and Java eco-systems are already quite good.

On VS, I can have at any given moment a graphical snapshot on how all threads and tasks are interacting with each other, or just execute some of the threads.

It doesn't solve everything, but it makes it easier than a typical gdb session.

Re:Why has CPU frequency ceased to grow? (2014) by kbart on Wednesday February 21, 2018 @06:14AM (#16428619)
.NET has one of the best ecosystem overall, so it's more an exception than a rule (can't comment on Java as I don't work with it). As I'm mostly in low level, embedded system programming, you are still stuck with gdb, Valgrind and other primitive tools there, because if there's some legacy "IDE" at all, it's most often just some half-assed Eclipse plugin.
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @06:48AM (#16428742)
At least looking to their product sites, Microchip and Green Hills seem to have quite good tooling, then again I don't have embedded experience on modern systems, beyond mobile devices.
Re:Why has CPU frequency ceased to grow? (2014) by kbart on Wednesday February 21, 2018 @07:15AM (#16428867)
Do Microchip even produces multi-core MCU's? Haven't seen one, though I worked mostly with Cortex-A series so might miss something.
Re:Why has CPU frequency ceased to grow? (2014) by pjmlp on Wednesday February 21, 2018 @07:52AM (#16429047)
As I said, I don't have much experience in real embedded domain outside mobile devices (iOS, Android, UWP), but aren't Cortex-A5 supposed to handle up to 4 cores?
Re:Why has CPU frequency ceased to grow? (2014) by kbart on Wednesday February 21, 2018 @10:00AM (#16429883)
Yes, so it looks like Microchip produces multi-core MCUs after all, though as I've mentioned, I haven't encountered them and can't comment about quality of their tools.
Re:Why has CPU frequency ceased to grow? (2014) by jbergens on Thursday February 22, 2018 @04:58AM (#16436497)
I guess it's not going to help a lot except in special cases. See for example what Linus had to say about many cores and the long discussion after.

https://www.realworldtech.com/forum/?threadid=146066&curpost...

Re:Why has CPU frequency ceased to grow? (2014) by kamaal on Wednesday February 21, 2018 @09:14AM (#16429535)
New languages are coming up, it will just take long adoption cycles, given the library and surrounding tooling ecosystem has to be mature enough to go with it.

Prominent examples being Go and Perl 6.

Perl 6 especially, given how audacious the project is. There are performance issues with it currently though, from what I hear they are working to fix it soon.

Re:Why has CPU frequency ceased to grow? (2014) by b2gills on Monday February 26, 2018 @07:27PM (#16470194)
I remember someone posting some Perl 6 code and C code that did the same thing. The Perl 6 code was shorter, easier to understand, more correct (Unicode), and was reported to be faster for what they were doing.

There are things which are slower, but since it is a higher level language it may be easier to try multiple algorithms one of which may be significantly faster. It also has many useful features included, which can be optimized in ways that aren't recommended for user code. (writing the algorithm in NQP) There is also a code specilizer (spesh) and a JIT.

Basically for many things it can be fast enough. Also if you profile your code and find something that is egregiously slow you should report it. Many times such things get optimized quickly.

Re:Why has CPU frequency ceased to grow? (2014) by eloisant on Wednesday February 21, 2018 @09:46AM (#16429785)
There are many languages that handle well parallelism, but not all problems really need parallelism in the program itself.

For example, for web programming, you can throw several machines (or processes) of your serial program to have it run in parallel for all practical purpose.

Re:Why has CPU frequency ceased to grow? (2014) by swiley on Wednesday February 21, 2018 @06:07AM (#16428594)
There are limits to how much parallelism will improve things, see amdahl's law.
Re:Why has CPU frequency ceased to grow? (2014) by kamaal on Wednesday February 21, 2018 @09:01AM (#16429457)
Sure, but let's start moving towards parallelism first. May be a few decades from now we would be close to breaking those limits.
Re:Why has CPU frequency ceased to grow? (2014) by Something1234 on Wednesday February 21, 2018 @06:04PM (#16433765)
That law is a fact of life. Its a form of diminishing returns, there's only so much you can do.
Re:Why has CPU frequency ceased to grow? (2014) by Entalpi on Wednesday February 21, 2018 @07:46AM (#16429025)
Re:Why has CPU frequency ceased to grow? (2014) by contravariant on Wednesday February 21, 2018 @09:00AM (#16429448)
Haskell kind of qualifies. You can't have race conditions when everything is immutable.

Of course this makes some other things a bit more difficult.

Re:Why has CPU frequency ceased to grow? (2014) by ddorian43 on Wednesday February 21, 2018 @04:59AM (#16428284)
Seastar framework
Re:Why has CPU frequency ceased to grow? (2014) by krylon on Wednesday February 21, 2018 @05:01AM (#16428298)
Honest question: Is that name a pun on C* (https://en.wikipedia.org/wiki/C*)?
Re:Why has CPU frequency ceased to grow? (2014) by elorant on Wednesday February 21, 2018 @04:52AM (#16428252)
Microsoft has developed Parallel Linq which is a subset of .net framework and works like a charm.
Re:Why has CPU frequency ceased to grow? (2014) by wiz21c on Wednesday February 21, 2018 @04:46AM (#16428204)
Is it depressing or is it a kind of signal we should listen to and try to interpret ?
Re:Why has CPU frequency ceased to grow? (2014) by TickleSteve on Wednesday February 21, 2018 @02:06PM (#16431996)
look at VHDL or Verilog programming for FPGAs. Its effectively exactly what you're talking about.
Re:Why has CPU frequency ceased to grow? (2014) by gameswithgo on Wednesday February 21, 2018 @09:34AM (#16429689)
shaders?
Re:Why has CPU frequency ceased to grow? (2014) by Bitcoin_McPonzi on Wednesday February 21, 2018 @09:22AM (#16429593)
In fact, there is! Erlang is extremely parallel. Processes are lightweight, share nothing, and run on as many CPUs you have.
Re:Why has CPU frequency ceased to grow? (2014) by djsumdog on Wednesday February 21, 2018 @09:25AM (#16429618)
And also its derivatives, like Elixir.
Re:Why has CPU frequency ceased to grow? (2014) by losteric on Wednesday February 21, 2018 @11:48AM (#16430789)
Elixir is amazing! The original author, José Valim, took a brilliant approach: Take a 30 year-old battle-tested highly-parallel VM, and build a modern language on top of it. Syntax is inspired by the good parts of Ruby (very clean), but nothing comes close in terms of the ease of parallelism... it's so natural, and insanely fast.

The unit tests are what convinced me this will be the next big thing. Beautifully clear syntax, succinct tests, and most importantly: Parallel out of the box. Hundreds of unit tests run instantaneously. Ruby TDD setups run tests that changed with maybe 1-2s lag... Elixir runs all the tests so fast that, at the beginning, I wasn't sure the tests were running.

Re:Why has CPU frequency ceased to grow? (2014) by digi_owl on Wednesday February 21, 2018 @06:19AM (#16428639)
I can't shake the feel that this parallelism thing will be nothing but a wild goose chase, because nature seems to be highly serial in all but the most macroscopic of senses.
Re:Why has CPU frequency ceased to grow? (2014) by simonh on Wednesday February 21, 2018 @07:09AM (#16428833)
How can you say that? Almost every part of every organism functions simultaneously all the time. At the community scale, organisms cooperate and communicate continuously in real time. My eldest daughter is going through an ant obsession phase at the moment, their communities and how they coordinate hundreds of individuals simultaneously are amazing. Nature and natural selection are the ultimate optimizers - if there is any way for an organism or species to extract even the tiniest survival or reproductive advantage, nature ruthlessly optimises for it. Parallel function and behaviour is one of it's primary tools.
Re:Why has CPU frequency ceased to grow? (2014) by pjc50 on Wednesday February 21, 2018 @06:37AM (#16428703)
All of your cells and neurons operate in parallel.
Re:Why has CPU frequency ceased to grow? (2014) by adwn on Wednesday February 21, 2018 @08:18AM (#16429190)
And yet you only have a single train of thought [1] – or multiple interleaved trains, but that's concurrency, not parallelism.

[1] Plus a couple of background processes, like breathing, that execute in parallel.

Re:Why has CPU frequency ceased to grow? (2014) by boomlinde on Wednesday February 21, 2018 @09:21AM (#16429592)
That's a huge simplification not pertaining to the fundamental nature of the brain. Maybe it is in the nature of our consciousness (which in itself is probably only an abstract concept) to perceive the processes it emerges from as a sequence of single trains of thought rather than a chaotic, continuous consolidation of processes both internal to the brain/body and outside of it.

You could look at society as a whole and see the zeitgeist as a singular "train of thought", but you'd probably still recognize humans as individual agents. I think we have a bias towards thinking of ourselves as the ultimate individuals, neither recognizing the processes within us (like those of our cells) or the processes beyond us (like those of a group of people, animals, plants etc.) as having a similar nature. This is probably a genetically advantageous trait.

Re:Why has CPU frequency ceased to grow? (2014) by adwn on Wednesday February 21, 2018 @11:45AM (#16430759)
> That's a huge simplification not pertaining to the fundamental nature of the brain.

I disagree. Conscious thinking is a crucial process that's inherently single-threaded, even though it runs on highly parallel hardware (the billions of neurons).

However, I must admit that my point doesn't necessarily contradict pjc's point, and I don't really agree with digi_owl's claim that parallelism is a "wild goose chase".

Re:Why has CPU frequency ceased to grow? (2014) by boomlinde on Wednesday February 21, 2018 @06:40PM (#16433964)
> I disagree. Conscious thinking is a crucial process that's inherently single-threaded, even though it runs on highly parallel hardware (the billions of neurons).

I don't even know what to make of that. What do you mean by "single-threaded" if at the same time you recognize that it "runs on highly parallel hardware"? If you actually mean that our consciousness emerges from a purely sequential process that happens to go on in a highly parallel system, no, that's clearly wrong. Experience, the fundamental basis of consciousness, actuates many parts of the brain at the same time. They process this information largely independently in different ways, and sometimes those processes result in a clear "train of thought" but most of the time they do not. You can not reason about the inherent nature of our consciousness in terms of trains of thought if you recognize any subjectivity to our experience that exists without reasoning or language. That's a matter of definition, of course, and without agreeing on a precise definition it's probably no use talking about what is inherent about it.

If that's not what you mean, CPU execution models are probably not a very helpful metaphor to explain your idea. The clearly defined layer of abstraction that separates a fully pipelined CPU design built with simultaneously operating logic gates from "single threaded" programs being executed on it doesn't exist in brains. I guess that's what bugs me most about this type of discussion on HN. It seems developers are very fond of taking their (admittedly versatile) hammers and hammer away at anything they can think of, for better or for worse.

Re:Why has CPU frequency ceased to grow? (2014) by adwn on Thursday February 22, 2018 @12:26AM (#16435328)
> If you actually mean that our consciousness [...]

I'm not talking about consciousness (as in qualia or subjective experience), but about conscious thinking as in train of thought or intentionally thinking about something. For me, this process itself feels very sequential.

Re:Why has CPU frequency ceased to grow? (2014) by tyingq on Wednesday February 21, 2018 @05:41AM (#16428476)
"there hasn't emerged a "parallel-by-default C++" kind of language + hardware system to exploit it"

That's roughly what Intel tried with Itanium. I don't know if whatever barriers they hit are still barriers today.

Re:Why has CPU frequency ceased to grow? (2014) by pjc50 on Wednesday February 21, 2018 @06:17AM (#16428634)
Not really - Itanium tried to move the instruction-level parallelism and the burden of re-ordering execution to the compiler. You could only execute the maximum six instructions per cycle if there were no data dependencies. So it only really works for certain kinds of algorithmic data-heavy execution; that's why VLIW is only found in DSP architectures today.

Good SE answer here: https://softwareengineering.stackexchange.com/questions/2793... especially the ones focusing on cache misses.

Re:Why has CPU frequency ceased to grow? (2014) by tyingq on Wednesday February 21, 2018 @07:34PM (#16434240)
"Itanium tried to move the instruction-level parallelism and the burden of re-ordering execution to the compiler"

That sounds a lot like "parallel-by-default C++" kind of language + hardware system to exploit it"

Just swapping "compiler" for language. They didn't succeed, but they did try

Edit: helping me understand where I'm off might be more helpful than a downvote. Does swapping "compiler" for "language" not respresent what Intel was trying to do?

Re:Why has CPU frequency ceased to grow? (2014) by TheLostOne on Wednesday February 21, 2018 @09:43AM (#16429760)
With the web and requests the default would look to be parallel for most developers. The container runtime (Ruby, Python, Java) just abstracts away the parallelism on different cores.