logoalt Hacker News

Gabrys1 • today at 6:45 AM • 3 replies • view on HN

I started wondering if there could be swap-aware GC, like first make the required page swapped in (not that there's any obvious API for that...) and only then pause the world?


Replies

debugnik • today at 6:54 AM

Aren't madvise and mincore the APIs you want?

➕ show 1 reply
serbuvlad • today at 6:48 AM

One can just add APIs to the Linux kernel, and this would be a pretty straightforward one. (though it might be a little more difficult to avoid a syscall here)

I'm sure an agent can work on this and get some numbers with a day's worth of tokens.

➕ show 2 replies
quotemstr • today at 6:57 AM

You could do lots of interesting things with sufficiently deep inter-layer integration.

For example, why not swap out not by LRU page but by dense node clusters on the heap graph, maintaining in-memory summaries of inbound and outbound edges for liveness? If you do this, you don't have to swap the cluster in to do a GC involving it.

If the whole cluster becomes unreachable, you wouldn't even have to swap it back in to get rid of it: you'd just drop the swap reference and deem the swap space free.

I don't see anything this deeply integrated happening near-term, but it's fun to think about.