News for hackers. Stuff that matters.
Re:CRIU, a project to implement checkpoint/restore functiona... by PhilipRoman on Friday June 21, 2024 @02:15PM (#40752189)
Would love a low-tech version of this which simply suspends the process and puts all mapped pages in swap (no persistence across reboot ofc). I think it could be used for scheduling large memory-bound jobs whose resource usage is not known in advance.
Re:CRIU, a project to implement checkpoint/restore functiona... by dividuum on Friday June 21, 2024 @02:21PM (#40752251)
Not sure that’s needed. Sending SIGSTOP (or using cgroup freeze) and letting the linux memory management do its job should do most of that already.
Re:CRIU, a project to implement checkpoint/restore functiona... by Agingcoder on Friday June 21, 2024 @02:33PM (#40752322)
Yes I confirm it works - I’ve been using this very behavior for years
Re:CRIU, a project to implement checkpoint/restore functiona... by paulddraper on Friday June 21, 2024 @08:36PM (#40755228)
Yep, nothing fancy needed
Re:CRIU, a project to implement checkpoint/restore functiona... by perihelions on Saturday June 22, 2024 @09:38AM (#40759062)
I've used this to speed-up CLI commands which have a slow startup phase. I run the process up to the point where it finishes initializing things and starts reading input, SIGSTOP there, and resume it later. You can identify that "reading input" library call with strace, and intercept it dynamically with an LD_PRELOAD shim.

I haven't yet figured out how to (neatly) persist this to disk, so I just sort of make a mini server-loop that catches signals and dispatches a fork() for each one, and that's my fast version of the CLI command. Delightfully ugly :)

(The killer app I'm trying to apply this to is LaTeX, so that I can write math notes in Emacs, incrementally, without visible latency. Unfortunately the running LaTeX process is slightly convoluted, and needs a few more tricks to get working in this way. This trick works on the plain TeX command out-of-the-box (it's like a 50x speedup), so I think I'm on the right track...)

Re:CRIU, a project to implement checkpoint/restore functiona... by karthink on Saturday June 22, 2024 @05:20PM (#40762320)
> The killer app I'm trying to apply this to is LaTeX, so that I can write math notes in Emacs, incrementally, without visible latency.

See texpresso [1] for one solution that does something like this with the LaTeX process.

Another, more conservative solution is the upcoming changes to Org mode's LaTeX previews [2] which can preview live as you type, with no Emacs input lag (Demos [3,4]).

[1] https://github.com/let-def/texpresso

[2] https://abode.karthinks.com/org-latex-preview/

[3] http://tinyurl.com/olp-auto-1

[4] https://tinyurl.com/ms2ksthc

Re:CRIU, a project to implement checkpoint/restore functiona... by perihelions on Saturday June 22, 2024 @05:47PM (#40762496)
I wasn't aware of either of those, so thank you very much for those referrals I shall take a close look at :)

(Are you by chance the author of org-latex-preview, or is it a coincidence of usernames?)

Re:CRIU, a project to implement checkpoint/restore functiona... by karthink on Sunday June 23, 2024 @01:50AM (#40765069)
I am one of the authors, should have mentioned. It's not part of Org yet, but should be some time this year.