The process needs to communicate its status to other processes on the same machine. To do this, he writes the relevant information in the file, each time rewriting it completely.
To make the state complete, a checksum is added to the end of the file, and readers, in the event of a checksum error, reread the file (this may mean that the writer has started updating the file, and part of the file has already been rewritten).
The question is whether there is a more elegant solution, without reference to the platform, for sharing file access.
An additional question is whether there is a guarantee that readers will see the changes in the same order in which the writer makes them (i.e., is it worth adding some ordinal number of the record in addition to the checksum).