LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-17-2012, 11:41 AM   #1
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Rep: Reputation: 6
Question Which pids are reserved for the kernel?


Hi!

I remember that I saw somewhere a parameter to define the minimum PID value for user processes, which means any PID that is below that is a kernel process.

The thing is, I don't remember where... was it in my kernel config?
How to read and define this value?

THANKS!
 
Old 07-17-2012, 01:11 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I'm afraid I have never heard about reserved PIDs. see here: http://en.wikipedia.org/wiki/Process_identifier. Can you please explain what do you mean?
 
Old 07-17-2012, 01:29 PM   #3
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by pan64 View Post
I'm afraid I have never heard about reserved PIDs. see here: http://en.wikipedia.org/wiki/Process_identifier. Can you please explain what do you mean?
If you look at
Code:
ps auxm
you'll realize all the first (small) PIDS are kernel processes.
You can e.g. guess that if PID < 300, this is a kernel process, so you'd better not try to kill it!

The thing is, this is not always 300 and this number can be configured (and read). I just don't remember where.
 
Old 07-17-2012, 01:35 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I see. There is no limit, there is no such number, it always depend on the actual configuration. There is no general rule.
 
Old 07-17-2012, 03:19 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by MisterBark View Post
you'll realize all the first (small) PIDS are kernel processes.
As to unique identifiers in kernels up to 2.6.18 (RHEL version w backports), what these processes have in common is all kernel threads share the same user Id (obviously 0) and the same session Id and process group Id. What's more is that, depending on the machines HW, "kthread" spawns a host of children which then share the common "kthread" ancestors identifiers.


Quote:
Originally Posted by MisterBark View Post
The thing is, this is not always 300 and this number can be configured (and read). I just don't remember where.
There is a "RESERVED_PIDS" with default value of 300 in kernel/pid.c (2.6.29 - 3.4: http://lxr.free-electrons.com/source...pid.c?v=2.6.29) but if you would run a '\ps axfo pid,ppid,pgid,sid,sess,uid,cmd --sort=pid' then you see no artificial limit is posed.


I'll move this thread out of the Linux Security forum to the Kernel forum as this in no way is related to Linux Security.
Next time please give a wee bit more thought to where you post, TIA.
 
Old 07-17-2012, 06:20 PM   #6
MisterBark
Member
 
Registered: Jul 2012
Location: Republic of Krakozhia
Distribution: Slackware & Zenwalk core + compile
Posts: 104

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by unSpawn View Post
There is a "RESERVED_PIDS" with default value of 300 in kernel/pid.c (2.6.29 - 3.4: http://lxr.free-electrons.com/source...pid.c?v=2.6.29) but if you would run a '\ps axfo pid,ppid,pgid,sid,sess,uid,cmd --sort=pid' then you see no artificial limit is posed.
Ah ok!
fine

Sorry, I've never seen there was kernel section!
 
Old 07-17-2012, 06:36 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
No need to be sorry, just have fun.
 
1 members found this post helpful.
Old 07-18-2012, 01:09 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
PID #1 (init) is hard-coded. This process-table entry is constructed "by hand" during kernel initialization, and this very special process cannot die. (If it does, the kernel panics.)

Some operating systems have several such "hand built" entries, and the definition and purpose of these special processes vary from system to system.

"Kernel threads" are parts of the operating system kernel that are need to operate in an asynchronous fashion. (For instance, kswapd needs to perform disk I/O and to wait for completion of those I/O operations.) They are nevertheless "fully part of the kernel" and as such they operate by special rules. They will typically have low-numbered PIDs although there are no fixed assignments.
 
  


Reply

Tags
kernel, pid, reserve



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Your running kernel is using more than 70% of the amount of space you reserved for kd barrie123 Red Hat 3 08-03-2011 09:44 AM
Guest Kernel Reserved Memory Very High nayabingi Linux - Virtualization and Cloud 1 04-14-2011 11:55 AM
How to get child pids from parent pid in linux kernel mode? epezhman Programming 2 07-01-2010 02:26 AM
C++ and PIDs dbcoder Programming 1 07-15-2004 08:58 PM
Multiple PIDs ? Si|entKey Linux - General 0 03-27-2001 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration