2

I want this program of mine to expose its status for others to read. The first thing that comes to my mind is to write this to a file, but the flow of my program makes it convenient to update this status several times a second which makes it stupid to write it to disk every time.

Is there for example a way of storing this file in memory only, available on the file system without manually mounting a ramdisk somewhere?

My program is written in Python, those reading its status could be anything.

haraldk
  • 21
  • 2
  • 1
    This almost seems like it might belong on http://programmers.stackexchange.com/. – Zoredache Mar 14 '12 at 20:53
  • It won't be physically written to the disk very often, because it is staying in filesystem cache. Just write a file several times per second. Trust the kernel for caching and sync-ing to disk (which you could force with `sync()` or `fsync()`...) – Basile Starynkevitch Mar 15 '12 at 06:34

3 Answers3

4

Why not have your program open a Unix or Network Socket, and build some kind of interface to allow systems to connect and request the status as needed?

Zoredache
  • 37,543
  • 7
  • 45
  • 61
1

Anything in /dev/shm, it's in ram so it's fast, and no syncing issues.

Marcin
  • 3,437
  • 1
  • 22
  • 15
0

What about creating a shared memory segment and opening that with your programs? One thing, all people sharing the shared memory segment MUST be on the same system.

mdpc
  • 188
  • 11