Hacker Newsnew | past | comments | ask | show | jobs | submit | awercliyuna's commentslogin

Just like the Rust executable is still on disk. Sure, if it is running, it is memory mapped, but it can still be paged out. This is not theoretical. In practice, upon request, the probability of finding the static page in cache should be similar to the probability of the executable not being paged out. (That's true as long as the actual data is the same, and the differing factors, like the size of the web server executable, are small compared to the amount of free memory.)


Author here. That server doesn't have swap enabled. It can't be paged out.


If the executable is on disk, it can be paged out unless you've used mlock() to tell the kernel to keep it resident.


Interesting. I've never heard of that happening before. Can you link a reference to where I can find out more about that aspect of the linux memory subsystem?


The mlock manual[0] has a "notes" section that provides a good brief summary. The GNU libc manual has more than anyone would ever want to read about memory management, including a section on memory locking[1].

On an intuitive level, think of swap as being a place the kernel can put memory the program has written. When you malloc(4096) and write some bytes into it, the kernel can't evict that page to disk unless there's some swap space to stick it in. However, executables are different because they're already on disk -- the in-memory version is just a cache (everything is cache (computers have too many caches)). The kernel is allowed to drop the copy of the program it has in memory, because it can always read it back from the original executable.

[0] https://man7.org/linux/man-pages/man2/mlock.2.html

[1] https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter...


It's one of the reasons why running without swap can have even worse pathological behaviour than running with swap. With swap the kernel can prioritise keeping code in RAM over little-used data, wheras without it when RAM fills up with data eventually the currently running hot code gets swapped out and performance completely tanks, meaning the system doesn't actually hit the nice OOM error you hope it would. (hence userspace utilities like earlyoom to kick in before the kernel's absolute last resort strategy).


I believe that when a file is mmap'd a page table is created for it in the . As you perform read/write on the file a fault loads the actual entries into that page table. As pages can be mapped they so too can be unmapped under pressure, without that falling back to swap (since it is already a file backed map, you wouldn't swap a file backed map to a different file after all).

There are a few relevant bits to this. You can MAP_POPULATE the file to prepopulate the entries and you can MAP_LOCKED to MAP_POPULATE + lock the pages in (unreliably). As mentioned in the man page for mmap MAP_LOCKED has some failure modes that you don't get with mlock.

https://www.man7.org/linux/man-pages/man2/mmap.2.html

I also found this page: https://eklitzke.org/mlock-and-mlockall

Oh, and this: https://access.redhat.com/documentation/en-us/red_hat_enterp...


If swap is off there is nowhere to page it out


There is a whole system put in place exactly for getting papers reviewed by (hopefully) competent experts: peer-reviewed journals. The system has many flaws, but at least in theory, that's precisely the purpose of its existence.

For most journals, submission is free and open to everyone. In particular, being an academic yourself is not a requirement. Of course, there are well-documented biases in the peer review system (some of which are indirect, like your background and writing style being different from that of the in-group). As a consequence your paper will start with a very heavy handicap.

However, since your objective is to get reviewed (not necessarily accepted/published in a prestigious journal), your objective should only be for your paper to be sent to peer reviewers. In other words, you only need to pass the first filter (the editor), which can already be a high bar for an outsider, but a much lower one than acceptance. If the reviewers then recommend rejection, then fine, at least you will get feedback because reviewers are typically requested to write a fairly detailed justifying report.

Here is a list of journals that may be relevant. Please send your manuscript to only one at a time, and only attempt another one after rejection. Simultaneous submission is regarded as very unethical.

Minds and Machines: https://www.springer.com/journal/11023

Philosophy of Artificial Intelligence: https://www.mcmp.philosophie.uni-muenchen.de/research/phil_a...

The AI Ethics Journal: https://www.aiethicsjournal.org/

Artificial Intelligence and Philosophy: https://www.omicsonline.org/scholarly/artificial-intelligenc...

Philosophies: https://www.mdpi.com/journal/philosophies

Regarding the paper itself, it is outside of my field of expertise, so I can only comment on the overall presentation... which is important if you want to convince the editor that its looks serious enough to warrant the effort of finding reviewers. I would advise removing everything from the first page except the title and abstract: the caveats, inspirations, apologies and thanks sections look unprofessional. Also, I could not find a discernible conclusion section. You do need to cite previous work (with a bibliography at the end of the paper). After you select the journal, look at a few papers published there, and emulate their structure. This will greatly improve your chances of getting past the editor and into proper peer review. (Editor rejections usually come with very limited justifications.)

Good luck!


Thanks, I'll definitely look into those resources. I don't know if I'll go the route of sending in the paper myself as I believe a thesis advisor might be necessary to establish whether I'm on the right track or not without spending months on this. It's in a weird area between philosophy and AI and I might need two or more people to weigh in (not in the sending to journals stage, but in the research stage). I also don't know if building a demonstrable model is necessary for A^. More questions than answers.

I hadn't know about these journals though so that's a definite plus. I'll keep them in mind when looking where to submit. I should also mention my aim isn't to publish per se, but to know whether I'm right. I don't know if publishing the results exclusively (if they are significant) would be ethical.

Thanks for the detailed reply!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: