News for hackers. Stuff that matters.
Re:How Google Code Search Worked (2012) by bminor13 on Thursday March 12, 2020 @11:12AM (#22557673)
A minor note in the article reads:

> To minimize I/O and take advantage of operating system caching, csearch uses mmap to map the index into memory and in doing so read directly from the operating system's file cache. This makes csearch run quickly on repeated runs without using a server process.

Does anyone know some resources where I can read more about this technique? (how-to, pros/cons, caveats, etc.) I'm interested in figuring out the best way to have a commandline tool persist state that it can quickly access across multiple runs, but so far a background server process is the only technique I'm familiar with.

Re:How Google Code Search Worked (2012) by akkartik on Thursday March 12, 2020 @12:20PM (#22558391)
Yeah, you have to run a server. When a process exits, all its mmap'd pages are reclaimed. Just like any other memory.
Re:How Google Code Search Worked (2012) by bminor13 on Thursday March 12, 2020 @01:53PM (#22559639)
But this excerpt says that this technique obviates the need for a server process? Are they saving the contents of memory into files using mmap, and then using this state on every run?
Re:How Google Code Search Worked (2012) by akkartik on Thursday March 12, 2020 @01:58PM (#22559703)
I just reread your quoted passage and noticed the reference to the OS's file cache. Ok, this is outside my knowledge :)