"just in time" filesystem using inotifywait and mkfifo

If you need it to be "fast and parallel", please try very hard to not reinvent the wheel: the in-kernel filesystem and pagecache are specifically tuned to be very fast, much faster than your custom "filesystem in userspace".

You have multiple better options:

  • copy the file in a temporary location;
  • even better, rather the copying them, use soft or hard links;
  • export them via a read-only NFS mounts

Finally, please note that inotify is a best effort framework to deliver file events. Under heavy load notifications can be lost, especially if using an high-level language binding (ie: python).

EDIT: so you want to intercept reads for on-the-fly file conversion. When reading from an empty pipe your legacy code will block, so inotifywait will show the READ event only after you wrote something to the very same pipe. To avoid the issue you should try to listen for OPEN events (rather than READ). Another option is to use LD_PRELOAD to replace the classical open() syscall with a custom version which will convert the file as required.