Welcome to the Linux Foundation Forum!

6.2 Lab - Not seeing any difference after changing kernel.pid_max

I'm not seeing any difference after changing kernel.pid_max. Am I doing something wrong?

[sfox@localhost ~]$ sysctl kernel.pid_max
kernel.pid_max = 24000
[sfox@localhost ~]$ cat /proc/sys/kernel/pid_max
24000
[sfox@localhost ~]$ cat &
[4] 2127

[4]+ Stopped cat
[sfox@localhost ~]$ kill -9 2127
[4]+ Killed cat
[sfox@localhost ~]$ sudo sysctl kernel.pid_max=10000
[sudo] password for sfox:
kernel.pid_max = 10000
[sfox@localhost ~]$ sudo su
[root@localhost sfox]# echo 10000 > /proc/sys/kernel/pid_max
[root@localhost sfox]# cat $_
cat: 10000: No such file or directory
[root@localhost sfox]# cat /proc/sys/kernel/pid_max
10000
[root@localhost sfox]# cat &
[1] 2222
[root@localhost sfox]# kill -9 2222
[1]+ Killed cat
[root@localhost sfox]#

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Posts: 916
    On some systems (which I haven't seen for a long time) you have to do
    systctl -w pid_max=12000
    or whatever, where the -w is for write. What distro is this?
    I think technically the -w is required but ignored by most installations.
    Read the man page for sysctl
  • Posts: 25
    Hi ultraninja,

    I think the reason you didn't see any difference after changing pid_max is because you didn't change it to a value less than the PID of your first cat process. That is, you changed pid_max to 10000 but the PID of the first cat process was 2127. If you had changed pid_max to 2000, I think you would then see the PIDs roll over to 300 again.

    Thanks,

    Adam
  • Posts: 20
    Thanks for that tip Adam. It worked perfectly. Though I set pid_max to 10000 again, it was lower than the pid of cat so the next cat started at 378. Excellent! How are you enjoying the course?
    1. [sfox@localhost ~]$ sudo sysctl kernel.pid_max
    2. [sudo] password for sfox:
    3. kernel.pid_max = 32768
    4. [sfox@localhost ~]$ cat &
    5. [1] 20081
    6.  
    7. [1]+ Stopped cat
    8. [sfox@localhost ~]$ kill -9 20081
    9. [1]+ Killed cat
    10. [sfox@localhost ~]$ sudo sysctl kernel.pid_max=10000
    11. kernel.pid_max = 10000
    12. [sfox@localhost ~]$ sudo su
    13. [root@localhost sfox]# echo 10000 > /proc/sys/kernel/pid_max
    14. [root@localhost sfox]# cat /proc/sys/kernel/pid_max
    15. 10000
    16. [root@localhost sfox]# exit
    17. exit
    18. [sfox@localhost ~]$ cat &
    19. [1] 378
    20.  
    21. [1]+ Stopped cat
    22. [sfox@localhost ~]$
    23.  
  • Posts: 25
    I thought the course was good and I learnt a lot. I went through everything twice before doing a third pass on only the parts relevant to the LFCS. I'm going to do a fourth pass on the parts that are relevant to the LFCE as a way of getting started on preparing for that exam.

    Thanks,

    Adam
  • Posts: 20
    Hopefully 4 passes should do it :P

    I haven't worked out a strategy yet, I was just going to work through all the materials and labs then see how confident I felt. Maybe do a few passes.
  • Posts: 25
    Three passes did it to get my LFCS :-). And the third pass was really focused on just those sections of the course that would be on the exam. In retrospect it was worth it. I was able to perform a lot of the tasks by instinct. If I had to stop to think about the process and look up the details I'm sure I would have run out of time. As it was, there were a couple of questions I had to skip over and didn't have time to get back to.

    Thanks,

    Adam

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training