About the pid of the process

后端 未结 7 1816
借酒劲吻你
借酒劲吻你 2020-12-11 14:39

I\'ve a somewhat silly question, if i have a series of processes that are created ... these are not necessarily some sort of inheritance, the pid of the processes have to be

7条回答
  •  抹茶落季
    2020-12-11 14:47

    Here's how to test what your system does:

    for i in $(seq 20); do ps; done | grep ps
    

    The PIDs of the "ps" commands are consecutive processes, or as close to consecutive as any other caller could reasonably expect to be able to spawn.

    My cygwin terminal on Windows allocates them randomly-ish, my web host allocates them sequentially (with occasional gaps which presumably are for processes run by other users or servers).

    Some consider sequential PID allocation to be a slight possible security concern, since it may leak information between users of a multi-user system.

提交回复
热议问题