I have an application (A) that updates some data (about 1 MB) every second. I can make this application write the data to a file of my choosing, but other than that it is out of my control. I need to read this data (entirely) in another application (B). This application is mine so I can code it however I want. So my question is: What is the appropriate way sharing the data between application A and B? I don't need the data to be retained in memory longer than it takes for application B to read it (on a reboot or whatever). I only need access to the fresh data if application A is running. My current solution is: Make application A write to /dev/shm/myapplication every second. Code application B so that it reads from /dev/shm/myapplication once every second. It works, but I am still curious if this is the "proper" way of doing it. Other answers and comments have lead me to believe that "/dev/shm" is a bad place for tinkering. See these sources: https://superuser.com/a/227714/359316 https://stackoverflow.com/a/42884337/2583765
asked Jan 17, 2022 at 9:35 153 10 10 bronze badgesSlighty out of my area of expertise, but I suspect the solutio n you are looking for is called a "named pipe"
Commented Jan 17, 2022 at 9:46 For small amounts of ephemeral data I beliebe /dev/shm is entirely appropriate. Commented Jan 17, 2022 at 9:47@davidgo: As I mentioned application A writes to file and there isn't really much I can do about that. How would I use a pipe on a file? Do you mean to read the file with cat and pipe that to my application somehow?
Commented Jan 17, 2022 at 9:52No. I mean create a named pipe - this appears as a file in the filesystem. Then program A can write to the named pipe (which it sees as a file) and program B can read from it. Again im not an expert on named pipes - but it seems like something you should read up on. (hence a comment, not an answer)
Commented Jan 17, 2022 at 10:32The advantage should be that you would get the information as it comes in. Right now by getting out of sync and/or operations taking slightly longer you might end up not "seeing" data with your application.