Silly question - PIDs in XP

VirtualLarry

No Lifer
Aug 25, 2001
56,578
10,215
126
As the title - unlike most *nix systems and W2K, XP's PIDs get re-used (though not duplicated), and ... well, it just seems strange to me. I realize that this re-use of now-defunct PIDs, may be a less-brittle method of dealing with PIDs on long-running systems, as eventually a linear PID increment would wrap around, and potentially start duplicating PIDs. But it sure is disconcerting, to see child processes, and non-system processes, with really low PID numbers. Is it known why MS did this? Just curious.
 

VirtualLarry

No Lifer
Aug 25, 2001
56,578
10,215
126
Originally posted by: n0cmonkey
I'm slow today (yeah yeah). You want predictable PIDs?

Since simply knowing some process's PID isn't a security issue that I can think of, given any reasonable OS support for permissions/ACLs, then yes, I would much prefer them. It's just odd, looking at a PID/task-list, and seeing more-recently-started child processes with lower PIDs than even long-running system processes. I guess it's just a question of personal preference, there's no technical reason that they couldn't be based on a one-way hash of the process's kernel-memory descriptor structure's address, or something like that (assuming that they filter out dupes).

But to me, non-predictable PIDs, would be like the OS randomly assigning drive letters (out of the pool of available ones), for newly-discovered volumes.

(For the record, I'm not a fan of Mozilla's profile-directory pathname "salting" process either.)
 

Stas

Senior member
Dec 31, 2004
664
0
71
Well... It could help writing *.bat files (since a certain process would have own PID). If that's the only purpose, then it's not worth it.
 

bsobel

Moderator Emeritus<br>Elite Member
Dec 9, 2001
13,346
0
0
But to me, non-predictable PIDs, would be like the OS randomly assigning drive letters (out of the pool of available ones), for newly-discovered volumes.

Typical VL overblown comparison. Suprised you haven't claimed its a MS comspiracy against you yet.. Drive letters are user interface items, 'randomly' assiging them is much more problematic. As for PIDS, they are there for compatibility reasons, they don't really matter. The system is object based, grab a handle to the process you care about.

Bill
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Doing a quick search on google brings up at least one reference to a race condition that OpenBSD's random pids prevented...
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
Unix-based systems switched to slightly randomized PIDs among other things for the benefit of stupid programs which created fils in /tmp with the pid in the filename - which is a security risk. Randomization lessens the risk without changing those programs.
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
Originally posted by: bsobel
But to me, non-predictable PIDs, would be like the OS randomly assigning drive letters (out of the pool of available ones), for newly-discovered volumes.

Typical VL overblown comparison. Suprised you haven't claimed its a MS comspiracy against you yet.. Drive letters are user interface items, 'randomly' assiging them is much more problematic. As for PIDS, they are there for compatibility reasons, they don't really matter. The system is object based, grab a handle to the process you care about.

Bill

agreed
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
As the title - unlike most *nix systems and W2K, XP's PIDs get re-used (though not duplicated), and ... well, it just seems strange to me

unix systems reuse PIDs as well, it's just that if the PIDs aren't being randomly generated the list has to wrap before they get reused. I believe Linux wraps after 32K PIDs.

But it sure is disconcerting, to see child processes, and non-system processes, with really low PID numbers. Is it known why MS did this? Just curious.

If it's disconcerting you're worrying about the wrong things. The PID of a process should be irrelevant except for when you want to send it a signal and then you should be finding the PID, not predicting what it will be.
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
But it sure is disconcerting, to see child processes, and non-system processes, with really low PID numbers. Is it known why MS did this? Just curious.

Disconcerting ---> [Larry to English translator] ---> There has to be something in here that Microsoft developers, who know far more than me, are doing wrong so that I can start a completely irrelevant, long winded, discussion in which I try to make myself look smart by arguing minute, trivial, and useless details comparing it to some other OS with a completely different architecture in which the details are expected to be different.

Long winded run on sentence above ---> [Smilin to English translator] ---> DILLIGAF?
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
Originally posted by: Haden
I don't understand why some answers are so bitter.
It seems that question should rather be why some OSes don't generate random pids:
linux patch info,
discussion thread

Hehe, You'll understand after you get to know Larry. Ask him about pagefiles or something :p

If anyone else had asked this may have turned into a real discussion by now.
 

stash

Diamond Member
Jun 22, 2000
5,468
0
0
Predictable PIDs?
No outbound firewall??
MS conspiracy to control my every thought??????

--What goes through VL's brain before it explodes.

;)
 

VirtualLarry

No Lifer
Aug 25, 2001
56,578
10,215
126
Originally posted by: Smilin
But it sure is disconcerting, to see child processes, and non-system processes, with really low PID numbers. Is it known why MS did this? Just curious.

Disconcerting ---> [Larry to English translator] ---> There has to be something in here that Microsoft developers, who know far more than me, are doing wrong so that I can start a completely irrelevant, long winded, discussion in which I try to make myself look smart by arguing minute, trivial, and useless details comparing it to some other OS with a completely different architecture in which the details are expected to be different.
Except that entire tirade is completely off-base and wrong.

I was simply commenting on the fact that under XP, PIDs appear to be non-sequential, like W2K (and most *nix), and it's extremely convenient, to list tasks sorted by PID, because that lists them in the relative order in which the processes started. For someone that is used to that, it is a bit disconcerting.

But my simple question was, in reference to XP - why?

But all of the other all-knowing souls on this board, themselves also (apparently) lacking an answer, decided to flame me instead. Fine.
 

stash

Diamond Member
Jun 22, 2000
5,468
0
0
But all of the other all-knowing souls on this board

Funny that the person who always has to have the last word would refer to people as 'all-knowing'