Welcome to the new 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?

[[email protected] ~]$ sysctl kernel.pid_max
kernel.pid_max = 24000
[[email protected] ~]$ cat /proc/sys/kernel/pid_max
24000
[[email protected] ~]$ cat &
[4] 2127

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

Comments

  • coopcoop Posts: 269
    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
  • adamherstadamherst 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
  • ultraninjaultraninja 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?
    
    [[email protected] ~]$ sudo sysctl kernel.pid_max
    [sudo] password for sfox: 
    kernel.pid_max = 32768
    [[email protected] ~]$ cat &
    [1] 20081
    
    [1]+  Stopped                 cat
    [[email protected] ~]$ kill -9 20081
    [1]+  Killed                  cat
    [[email protected] ~]$ sudo sysctl kernel.pid_max=10000
    kernel.pid_max = 10000
    [[email protected] ~]$ sudo su
    [[email protected] sfox]# echo 10000 > /proc/sys/kernel/pid_max
    [[email protected] sfox]# cat /proc/sys/kernel/pid_max 
    10000
    [[email protected] sfox]# exit
    exit
    [[email protected] ~]$ cat &
    [1] 378
    
    [1]+  Stopped                 cat
    [[email protected] ~]$
    
    
  • adamherstadamherst 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
  • ultraninjaultraninja 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.
  • adamherstadamherst 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
Sign In or Register to comment.