3 ms·
One problem with reading /proc is that its impossible to get consistent view of the whole system because you are iterating the processes one by one, instead of
by zokier 2y ago
One problem with reading /proc is that its impossible to get consistent view of the whole system because you are iterating the processes one by one, instead of getting snapshot of all the processes.
- yjftsjthsd-h 2y agoIs there an OS that provides the whole result of ps(1) or equivalent in one syscall? I was under the impression that it was ~always iteration based.
- zokier 2y agoOn NT you can get this sort of stuff through WMI, although I'll admit it's not entirely clear to me how that resolves internally
- yjftsjthsd-h 2y agoI guess my point/question was more - is whatever system/library call you'd use atomic? There's technically no reason the system couldn't have a syscall that returns a full data structure of process info for as many processes as are in scope and guarantee that it's a perfect atomic snapshot of exactly how the process table looked when that call returned, but I'd want to be very confident and have explicit documentation promising as much before I depended on it.