0

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.

6
  • @dsstorefile Thanks, I missed that. Maybe I should delete my question? Still, I'd be happy about an autoritative link. – maaartinus Apr 23 '18 at 1:54
  • 2
    Nothing more authoritative than the links to the code in this answer: unix.stackexchange.com/a/121884/70524 – muru Apr 23 '18 at 1:58
  • I have flag duplicates of my question because, I'm not 100% sur e about what your asking but I really feel like I answer it already. – Kiwy Apr 23 '18 at 13:01
  • @Kiwy To clarify what I'm asking: 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. But I guess, the fact that nobody shares my concern is a strong enough indication of the data being always up to date. – maaartinus Apr 24 '18 at 2:30
  • @maaartinus please edit your question with this bit of information and I will consider a reopen vote. Also you could consult this answer stackoverflow.com/a/31249032/1195001 – Kiwy Apr 24 '18 at 7:35

Browse other questions tagged or ask your own question.