RFR 9: 8077350 Process API Updates Implementation Review

Roger Riggs Roger.Riggs at Oracle.com
Thu May 7 14:11:48 UTC 2015


fyi, with respect to using the start time to uniquely identify a process.

It turns out that on Linux[1] looking at st_mtime from 
stat(/proc/pid/status)
doesn't always produce the same value (and the inode number can change).
When spawning large number of processes (< 500)
it appears the pseudo inode entries are not kept around and are 
re-initialized.

In a brief peek at the Linux code in fs/proc/inode.c it appears always 
to initialize
st_mtime/st_atime/st_ctime from the current time.
It seems a slightly more expensive read and parse of the file will be 
needed
to get and check the start time.

fyi, Roger

[1] Ubuntu 14.04.  (Linux-3.13.0) sources



On 4/17/2015 4:05 AM, Peter Levart wrote:
>
> At least on Linux (/proc/<pid>/stat) and Solaris (/proc/<pid>/status) 
> it is not necessary to open those special files and read them. Just 
> doing stat() on them and using the st_mtime will get you the process 
> start time. I see AIX shares native code with Linux (unix), so perhaps 
> AIX does the same. Mac OSX and Windows have special calls...




More information about the core-libs-dev mailing list