76 points · by tosh · 12y ago · 16 comments
Title of submission: "Pauseless GC for OpenJDK"
Within the first minute of the presentation: "Shanendoah is not pauseless" (0:45, emphasis mine).
The presenter then continues, "It could be pauseless. We have plans to make it pauseless, but for now the first step is just doing concurrent evacuation."
Perhaps a more apropriate submission headline would be "Potentially pauseless GC for OpenJDK" or something along those lines?
I think there are two big challenges for garbage collected environments with respect to core server systems level code. First, an acceptable pause needs to be reliably sub-millisecond or it breaks the userspace schedulers in a lot of high-performance server code. In the video presentation, they had a difficult time guaranteeing 10 milliseconds. They are working on it but this is a problem. Second, most high-performance server engines eliminate almost everything that looks like context-switching, mostly because it is very expensive on modern hardware. The idea that there may be hundreds or even thousands of threads running on real servers does not comport with the reality of a lot of server environments where context switching is severely restricted for good reason. The idea that it makes sense to have a lot of background processes cleaning up the memory allocation contradicts many well-conceived software architectures. These days, everything is explicitly scheduled and bounded if server performance matters.
In fairness, the estimate was 10 milliseconds for 100 GB heaps. Not everything (especially, I'd guess, programs that benefit from pauseless GC) deals with that much memory.
This also lead me to research systems like Mesa/Cedar, Modula-2+, Modula-3, or more recently Singularity.
Different approaches were taken, RC with local GC for collecting cycles (Cedar/Modula-2+), GC as kernel service (Modula-2+/3, Oberon), static binaries with runtime enabled GC Syngularity.
So nowadays I tend to refer to automatic memory management in general, be it GC, RC, RAII or via dataflow analysis.
System programming languages with GC trace back to Algol 68.
Yet, besides Apple work with ARC or Microsoft with Singularity/COM/WinRT, there isn't much happening in mainstream OS mostly due to backwards compatibility to the culture that followed UNIX instead of Xerox PARC systems.
If systems like Mesa/Cedar had the focus and money spent that JVM or V8 enjoy, the computing world would be a bit different.
Personally, deal with the low-hanging fruit first. For example: there are plenty of cases where an optimizing compiler could statically (read: at compile time) compute the lifespan of an object and thus bypass the GC entirely. (Or, for another example for a related issue: recognize that a threadsafe object can only be accessed by one thread and as such can be optimized in ways that break update order.) And yet most compilers don't see to do this sort of optimization, or do so in an extremely limited fashion.
In other words: deal with the slowness of garbage collection after you've reduced the amount of garbage to be collected.
Take Java. One of the concepts of Java was that you didn't need to worry about the stack / heap distinction - the JVM handles where to put things. But in practice, all this ends up doing is making (almost) everything ends up on the heap. And then people wonder why it's slower and more memory-hungry.
(Also: I wish compilers would be smarter about function boundaries. Have functions be source-level constructs, that get turned into a single global control flow graph, which the compiler then inspects to determine where function boundaries "make sense". With manual overrides of course.)
Per https://groups.google.com/forum/#!topic/mechanical-sympathy/... the Linux kernel types had no interest in incorporating it (it requires some things like bulk page table changes with only one clearing of the TBL at the end).
Having a pluggable scheduler and memory management module might be nice for other pauseless GCs too, but not sure how that relates to any patents Azul may hold in this area, for instance: https://www.google.com/patents/US8452938?dq=ininventor:%22Gi...