Better HN
topnewbestaskshowjobs
Log inSign up

offlinemark

9 karma · joined Jun 25, 2020 (6y ago) · 7 submissions

Programmer, interested in security, operating systems, compilers. Formerly infosec, now in audio development.

@offlinemark / https://offlinemark.com

Submissions

comment 6y ago · link · parent

This has been answered on Twitter: https://twitter.com/vic_mic_/status/1317958553236250624

comment 6y ago · link · parent

> Perhaps what you would want is a hybrid: let the OS page stuff out by default so you can free up the libraries and startup code and data structures etc. But if your disk hits some thrashing threshold because the working sets get larger than memory, let some variant of OOM killer loose?

Linux does a form of this. File mappings are paged out to disk (reclaimed) by default, and the OOM killer is only triggered if this is not enough. This gets you pretty far, as it includes all binaries and libraries.

comment 6y ago · link · parent

Thanks for sharing in this detail. I don't have production SRE experience, so this is fascinating to read. I understand that the OOM killer has caused you quite a lot of pain!

I shouldn't have even mentioned the OOM killer. My point was merely: Due to those great lengths, memory availability is highly dynamic. Committing memory up front prevents optimizations where the kernel can reclaim memory "just in time" to allow a mapping to succeed and not require killing anything.

comment 6y ago · link · parent

Thanks for surfacing the question agf. Hopefully someone here can help :)

comment 6y ago · link · parent

You're right, I probably should have said "some operating systems". I was generalizing based on my own education, which used Linux. I believe Windows does not do this either, but I'm not sure how many OS 101 classes teach Windows kernel :)

> The advantage is that you find out if you don't have enough memory when you make the system call to request it, not by having the program killed.

I wonder how much of an advantage this is. Memory availability is constantly in flux, and Linux at least, goes to great lengths to reclaim memory before invoking the OOM killer, which is a last resort. What if memory frees up immediately after the application gets the error return, but before the app touches it?

I'd trust the kernel more to manage this than applications themselves, because the kernel can make much better decisions on how to juggle things (evicting caches and whatnot). Plus, we all know how well we all test our error handling paths :)

> (It may be time for paging out to disk to go away. It's a huge performance hit. Mobile doesn't do it. And RAM is so cheap.)

In case anyone is interested in learning more, this is an excellent article discussing the nuances of paging to disk: https://chrisdown.name/2018/01/02/in-defence-of-swap.html

Re: mobile, does Android disable paging file mappings to disk, which happens even if swap is disabled? (Swap only affects anonymous mappings).

6.

What they don’t tell you about demand paging in school(offlinemark.com ↗)

4 points · by offlinemark · 6y ago · discuss

7.

How to set up an ARM64 playground on Ubuntu x64(dev.to ↗)

2 points · by offlinemark · 6y ago · discuss