We're implementing an embedded Linux system and have to provide a live updating graph on a website that shows data coming from a background process in the system.
The question is how to optimally share data between:
The data generating process that regularly updates a ring buffer with new values, written in C.
The webserver CGI function that must fetch the latest contents of the buffer. We use Python for CGI's (nginx+wsgi+flask).
I currently lean towards making a unix socket solution for this, but I gather this would require multithreading in the C program to make sure the background process isn't disturbed.
I wonder if there isn't a simpler way. Could we map the buffer memory directly to be a virtual file? What about using a normal file on a RAM disk as the buffer and just seeking and writing to it?