Skip to main content

Timeline for Duration of /proc/pid/stat

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Apr 12, 2016 at 7:26 comment added Gilles 'SO- stop being evil' @user3629249 Once again, no. Try it on Linux, for example: if you leave it running for long enough, eventually the PIDs reach 32767, which is the maximum value, and then they start again at the first free PID. If PIDs were never reused, that would mean that the system would lock up after a certain number of forks! How long you have before a PID is reused depends on how long the process survived: if it survived for about 32700 forks, the PID could be the next one to be reused.
Apr 12, 2016 at 1:15 comment added user3629249 @Gilles, My experience, with linux and unix, is that pids are not reused. Otherwise there would be little to no gaps in the PID values and a long running computer would not have huge PID values
Apr 11, 2016 at 0:30 comment added Gilles 'SO- stop being evil' /proc/<pid>/stat no longer exists by the time wait returns. You mention a short delay during which it still exists, but that doesn't jibe with my reading of the code, nor with my understanding of the architecture (the data is supposed to be reclaimed when the parent calls wait), and I cannot reproduce this on Debian jessie. What kernel version are you using? Are you absolutely sure about the timing and that you're hitting the right child? In any case, it's clearly not something you can count on.
Apr 10, 2016 at 20:40 history edited Gilles 'SO- stop being evil'
edited tags
Apr 10, 2016 at 20:39 comment added Gilles 'SO- stop being evil' @user3629249 That's completely wrong. PID values are reused.
Apr 10, 2016 at 18:23 comment added user3629249 pid values are not re-used. The count will be incremented with each new process. The only 'reasonable' method of resetting the count is to re-boot the computer.
Apr 10, 2016 at 8:34 comment added meuh If you are using C, see also getrusage(2) and times(2).
Apr 10, 2016 at 8:18 answer added v7d8dpo4 timeline score: 2
Apr 10, 2016 at 6:19 history asked Gaius CC BY-SA 3.0