Live data from Hacker News

For Better Computing, Liberate CPUs from Garbage Collection

spectrum.ieee.org

51–60 of 460 posts

Re: For Better Computing, Liberate CPUs from Garbage Collection

#51
post #49

Maybe I'm naive, but with multi-core CPUs, and parallel GCs, isn't it somehow the same? One core is mostly only used for GC, while the others do other things? Edit: I guess they mention their chip itself can do it at a high level of parallelism, so that's probably one more advantage. But CPUs with additional slower cores and a lot more cores are in the works as well.

But the GC has to do it in a thread safe way which involves locking/synchronization. Otherwise you get nasty race conditions.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#52
post #9

Azul Systems has asked Intel to do this once... but instead created their own processors with interesting memory barrier properties for awhile that greatly sped up JVMs beyond what was capable (at the time) on x86-32/ppc/sparc. Eventually they gave up and became a purely software company, but their "Java Mainframe" product was many times faster than the Intels of the age executing the same code despite much slower CP…

I had a mentor who worked at Intel labs when this was happening. The reason this died was because someone invented a gc algorithm which consistently outperformed this, leading Intel to drop their hardware gc plans.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#53

So my idea for GC is to offload it to a separate machine through a communications channel. The main CPU sends messages to the co-processor whenever it allocates memory, or whenever it mutates (whenever it writes a pointer to allocated memory or to the root set- there could be special versions of the move instructions which send these messages as a side-effect). There is a hardware queue for these messages and the mai…

The first part is basically what erlang vm already does.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#54
post #21

> globally this represents a large amount of computing resources. Much of which would just sit idle otherwise, on client machines. Of course, the energy savings still apply. > He also points out that many garbage collection mechanisms can result in unpredictable pauses, where the computer system stops for a brief moment to clean up its memory. This is more of a hard barrier that's being solved. All in all pretty cool…

Looking at the underlying paper, I'm actually skeptical that there's any practical performance/energy boosts from this accelerator. The best case they're giving is something like a ~3-5× boost on GC (which is generally ~10% of total time, much of it hopefully idle time anyways if you're tuning GC well), with a 15% power reduction, assuming your collector is a stop-the-world, non-concurrent collector (and you rewrite your object layout). There's no measurement of the energy cost of the idling core, nor of the cost of extra memory and cache traffic trundling objects to and from the accelerator rather than sticking on the core. Those costs are likely to be even worse if you try to adapt this into incremental and concurrent collectors.

Especially when you ask the question "is it better to spend the area/power budget on a highly-specialized accelerator, or to give it over to another full core that can do other things when it's not collecting garbage," it's hard to motivate this kind of accelerator.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#55

Seems like we could just as easily stop using garbage collection. ... or even go back to reference counting / smart pointers and just live with the “limitation” that we can’t have circular references.

Depending on the workload different memory allocation strategies perform better or worse. GC systems usually even have the fastest allocation. The only problem is that you see deallocation as one big block that is completely disconnected from allocation.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#56
post #51
post #49

Maybe I'm naive, but with multi-core CPUs, and parallel GCs, isn't it somehow the same? One core is mostly only used for GC, while the others do other things? Edit: I guess they mention their chip itself can do it at a high level of parallelism, so that's probably one more advantage. But CPUs with additional slower cores and a lot more cores are in the works as well.

But the GC has to do it in a thread safe way which involves locking/synchronization. Otherwise you get nasty race conditions.

Well, I can't read the paper, but how is their Chip not having those same issues?

Re: For Better Computing, Liberate CPUs from Garbage Collection

#57

From an environmental perspective, I wonder how much energy is consumed (and emissions generated) for garbage collection and interpreters. These things exist to make programming easier but are then duplicated across thousands of servers. If everyone used some compiled language that was just a little simpler, a little safer, had just a little better memory management/tooling, or like here, had better hardware support,…

So... Rust, basically

There’s actually a nice article about improving performance in rust with a bump allocator, which is conceptually similar to garbage collection: https://hacks.mozilla.org/2019/03/fast-bump-allocated-virtua...

Re: For Better Computing, Liberate CPUs from Garbage Collection

#58
post #40

Earlier quoted context omitted.

Python still uses mark and sweep occasionally to clean up structures where reference counting fails.

It has optional cycle detection, yep. But... you could also just spend a couple of minutes to not have cyclic references.

Closures are objects that can participate in cycles. And the lifetime of closures is very hard to track statically.

Re: For Better Computing, Liberate CPUs from Garbage Collection

#59

Seems like we could just as easily stop using garbage collection. ... or even go back to reference counting / smart pointers and just live with the “limitation” that we can’t have circular references.

Why would a reaction to a faster / low resource GC method be to stop using GC?

Re: For Better Computing, Liberate CPUs from Garbage Collection

#60

Seems like we could just as easily stop using garbage collection. ... or even go back to reference counting / smart pointers and just live with the “limitation” that we can’t have circular references.

Reference counting is already slower than having a GC in most practical applications, not to mention that having no circular references may make the code where you need 'em either slower or means you'll have to write a workaround, which is often also overhead and makes things more complicated.
Post reply on HN