Live data from Hacker News

Safepoints and Fil-C

fil-c.org

41–45 of 45 posts

Re: Safepoints and Fil-C

#41

Earlier quoted context omitted.

Can we make the C library mutex lock and condvar primitives work on the vfork() child? It's practically like a thread...

That might be the way to go but my best ideas for how to make vfork work sidestep all of that. It's just a lot of work. It basically means that the whole Fil-C runtime has to be aware of this alternate mode where we're the vfork child and we have to play by different rules. Anyway, long story short: - Yeah I know vfork(2) is important. It's just not the most important thing on my plate. The constant time crypto situa…

Understood, and I agree that constant-time assembly-coded crypto is much more important. Moreover, if you make `posix_spawn()` fast that's enough, and you can probably do that by proxying it from the victim program's C library to Fil-C's.

Re: Safepoints and Fil-C

#42
post #27

Earlier quoted context omitted.

> Remember that the child side of `vfork(2)` can only do async-signal-safe things as `vfork(2)` is documented And if it does anything that isn't async-signal-safe, then all bets are off. So, the Fil-C implementation of vfork(2) would have to have some way of checking (either statically or dynamically) that nothing async-signal-unsafe happens. That's the hard bit. That's why I think that implementing it is crazy. I'd…

The other place it comes up is launchers and resource managers. We actually have a series of old issues and implementation work on flux (large scale resource manager for clusters) working around fork becoming a significant bottleneck in parallel launch. IIRC it showed up when we had ~1gb of memory in use and needed to spawn between 64 and 192 processes per node. That said, we actually didn’t pivot to vfork, we pivote…

> That said, we actually didn’t pivot to vfork, we pivoted to posix_spawn for all but the case where we have to change working directory (had to support old glibc without the attr for that in spawn).

You can always accomplish that sort of thing by using a helper program that ultimately execs the desired one -- just prefix it and its arguments to the intended argv.

Re: Safepoints and Fil-C

#43
post #8

Earlier quoted context omitted.

Note that it is very simplistic to say Java has a compacting garbage collector, between Oracle JDK, OpenJDK, Temurin, Azul, PTC, Aicas, microEJ, OpenJ9, GraalVM, Jikes RVM, and the cousin Android, there is pleothora of GC configurations to chose from, that go beyond that.

Not to mention that many of them have multiple GC's that are selected as startup options. Personally though I can't wait for Azul's patents to start running out so that OS vendors can start implementing similar machinery into mainline OS's for all runtimes to use.

Unfortunately that problem is cultural, not patents.

Re: Safepoints and Fil-C

#44
post #27

Earlier quoted context omitted.

The other place it comes up is launchers and resource managers. We actually have a series of old issues and implementation work on flux (large scale resource manager for clusters) working around fork becoming a significant bottleneck in parallel launch. IIRC it showed up when we had ~1gb of memory in use and needed to spawn between 64 and 192 processes per node. That said, we actually didn’t pivot to vfork, we pivote…

> That said, we actually didn’t pivot to vfork, we pivoted to posix_spawn for all but the case where we have to change working directory (had to support old glibc without the attr for that in spawn). You can always accomplish that sort of thing by using a helper program that ultimately execs the desired one -- just prefix it and its arguments to the intended argv.

Quite so. We would have too, but I left out the nasty bit that someone had at one point put a callback argument in an internal launching API that runs between fork and exec. Still working on squashing the last of those.

Re: Safepoints and Fil-C

#45
post #32

Earlier quoted context omitted.

I believe, Oracle JVM uses polling? This is the class responsible for safepoints: https://github.com/openjdk/jdk/blob/4b544f93ad0e2beae4c80e06... And this is one of the implementations: https://github.com/openjdk/jdk/blob/4b544f93ad0e2beae4c80e06... The arming code: https://github.com/openjdk/jdk/blob/4b544f93ad0e2beae4c80e06... I might be missing something, but I'd be terribly surprised if VM games are worth it.

That JVM totally uses the page protection trick. Look at the code that talks about polling page.

D'oh. I don't know how I missed it. It's right there around the line 69. Nice.

Well, I'm definitely surprised it works.

Post reply on HN