I implement an app with some list of process IDs. I used Runtime.getRuntime().exec("ps") to became this list. But I don´t need all processes like PID 1 --> init. There are some max. PID value for this standard PIDs ? Can I just filter them by using something like if PID > 1000 , then use it?
I implement an app with some list of process IDs. I used Runtime.getRuntime().exec(ps) to
Share
The only guaranteed PID is that of
initwhich is1. The other processes that start up early will usually get a PID in the same (short) range just because they’re started mostly in the same order every time, but you can’t really rely on that.You’ll need to filter yourself, a pure numeric filter will not work all the time. (PIDs can get recycled too, so it is entirely possible to get a normal, user process with a very low PID.)