Recently, a friend used a memory-mapped file to store the routing graph for his own routing engine. Linux reads byte ranges from this file as needed by the engine. I was curious to see if the routing graph file could be stored on a remote host and the byte ranges of the memory-mapped file could be sent on-demand over http. It turns out this is possible with pyfuse3 in Python.
All I had to do was to install libfuse and run a python script which mounts a custom file system at a given mount point. In that script you need to inherit from the pyfuse3.Operations class and then you can overwrite some member functions like getattr(), lookup(), opendir(), or read() which I guess are Linux file system operations. In particular the read() function is interesting. You can think of it as a callback where you can decide what data you want to return to the operating system when a file is read. Here, I just had python make a http range request to the file on the remote host and return the bytes to the operating system.
Of course this is a bit convoluted. The routing engine might as well request the bytes it needs over http itself, but I found this approach still insightful. It shows for example how Linux handles reading from memory-mapped files.
Another use case for such a pyfuse3 file system might be debugging multithreaded applications. Instead of reading the data over http, one can also read data from the local disk in the python callback. The callback could then for example just log to the console which byte ranges from which files are read. Maybe that could be useful for understanding how multiple parallel processes compete for disk reads. How sequential or random they are is in particular important for optimising read patterns on hard disks.