News for hackers. Stuff that matters.
Re:For Better Computing, Liberate CPUs from Garbage Collection by viraptor on Thursday May 09, 2019 @09:07AM (#19867896)
> Naive ARC is AFAIK very expensive as it causes a lot of updates

It also means you can't really rely on CoW after fork(). After a while your whole heap will be duplicated in every process because of the RC updates.

Re:For Better Computing, Liberate CPUs from Garbage Collection by geocar on Thursday May 09, 2019 @12:41PM (#19869788)
A simple trick gets you around this: Don't use your system malloc() but instead map a tempfile (or a memfd) with MAP_SHARED and use the STM primitives to update your references. If you combine this trick with __attribute__((address_space(256))) your "pointers" are also the offsets in the tempfile.

Or don't: Maybe you want two heaps. fork() gives you the option!

Re:For Better Computing, Liberate CPUs from Garbage Collection by simonask on Thursday May 09, 2019 @01:45PM (#19870414)
Lots of things that people do don't work after `fork()`, though, to the point where `fork()` has become largely irrelevant in new code. For example, threads are not generally compatible. You can also easily run into issues with open files, file locks, etc.

Of course, your point might still be relevant in "legacy" environments with poor threading support anyway. I would argue that those are gradually going away, as even interpreted languages without exposed threading support are increasingly using threads or adopting threads to accommodate performance needs.

Re:For Better Computing, Liberate CPUs from Garbage Collection by viraptor on Thursday May 09, 2019 @04:39PM (#19872198)
This is not legacy. Any application in Ruby, Python, Perl, ... is affected. Majority of the backends of current web have the issue of duplicated heap in all the workers. It's made slightly better by Python introducing gc.freeze in 3.7 (https://docs.python.org/3/library/gc.html#gc.freeze) and Ruby doing something similar soon, but not great.
Re:For Better Computing, Liberate CPUs from Garbage Collection by fnord123 on Thursday May 09, 2019 @10:30AM (#19868590)
That's a nice point. yikes.