I know that /proc
gets generated on the fly, but I'm curious, if fork
, evecve
and process termination are guaranteed to be seen by all other processes immediately.
Obviously, the kernel knows it all, but I'd like to see explicitly stated, that the presented information is really always up to date. I could imagine the kernel might choose to minimize synchronization overhead or whatever by batching updates to some internal structures used for /proc
.
This sounds improbable, but there is a problem with our code, which could be explained by this. It's misusing reading /proc
for a "single instance check" (which is racy and IMHO plain wrong). When two instances get started nearly concurrently, then it obviously can happen, that each sees itself and the other instance and both complain. However, it looks like the opposite problem (no instance complains) happens to our customers.
Clarification
The doc states that "For making accounting scalable, RSS related information are handled in an asynchronous manner and the value may not be very precise". Analogously the whole process list could be handled asynchronously and that's what I'd like to see clearly confuted. An
This answer says that
Most (if not all) files in the /proc filesystem are special files, their content at any given moment reflect the actual OS/kernel data at that very moment, they're not files with contents periodically updated.
But it doesn't say if "most" includes what I care about, nor does it claim to be an authoritative answer.