Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ ps -ef |grep kmail
- alex 9135 1 5 21:41 ? 00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9187 4720 0 21:42 ? 00:00:00 kio_smtp [kdeinit] smtp /tmp/ksocket-alex/klauncherVyvPMa.slave-socket /tmp/ksocket-alex/kmailYD9BPb.slave-socket
- alex 9462 5410 0 21:44 pts/0 00:00:00 grep kmail
- $ ps aux |grep kmail
- alex 9135 4.7 12.5 313560 259672 ? Sl 21:41 0:09 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9187 0.0 0.4 31080 8908 ? S 21:42 0:00 kio_smtp [kdeinit] smtp /tmp/ksocket-alex/klauncherVyvPMa.slave-socket /tmp/ksocket-alex/kmailYD9BPb.slave-socket
- alex 9464 0.0 0.0 2884 804 pts/0 S+ 21:44 0:00 grep kmail
- $ pstree -p|grep kmail
- |-kmail(9135)-+-ispell(9145)
- | |-{kmail}(9136)
- | |-{kmail}(9137)
- | |-{kmail}(9138)
- | `-{kmail}(9139)
- $ ps -ef |grep 9136
- alex 9477 5410 0 21:45 pts/0 00:00:00 grep 9136
- $ ps aux |grep 9136
- alex 9479 0.0 0.0 2876 788 pts/0 S+ 21:45 0:00 grep 9136
- $ pstree -p|grep kmail
- |-kmail(9135)-+-ispell(9145)
- | |-{kmail}(9136)
- | |-{kmail}(9137)
- | |-{kmail}(9138)
- | `-{kmail}(9139)
- ##################################### mystery resolved by \amethyst ##################################
- ps -eTf | grep kmail
- alex 9135 9135 1 1 21:41 ? 00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9136 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9137 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9138 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9139 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9552 9552 5410 0 21:51 pts/0 00:00:00 grep kmail
- ######################################## TIP of the first process is PID+1, second PID+2 ? ######################################
- $ ps -eTf | awk '{print $2, $9}'
- ...
- 8595 scribus
- 9135 kmail
- 9135 kmail
- 9135 kmail
- 9135 kmail
- 9135 kmail
- 9145 ispell
- 9146 ispell
- 9147 ispell
- 9150 ispell
- 9151 ispell
- 9152 ispell
- 9154 ispell
- 9155 ispell
- 9156 ispell
- 9162 ispell
- 9163 ispell
- 9165 ispell
- 9166 ispell
- 9167 ispell
- 9168 ispell
- 9169 ispell
- 9170 ispell
- 9171 ispell
- 9172 ispell
- 9173 ispell
- 9174 ispell
- 9175 ispell
- 9176 ispell
- 9640 smtpd
- ...
- ##################################### I've understand ! ###############################################
- $ ps -eTf | head -1 ; ps -eTf | grep kmail
- UID PID SPID PPID C STIME TTY TIME CMD
- alex 9135 9135 1 0 21:41 ? 00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9136 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9137 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9138 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9135 9139 1 0 21:41 ? 00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
- alex 9732 9732 5410 0 22:10 pts/0 00:00:00 grep kmail
- This is the same PID, and the SPID use PID++
- But a question : PPID = 1 for all threads mean that the parent is init (PID 1) ?
- ================================= The discussion with \amethyst on #debian - Freenode ===================================
- $ egrep -i "amethyst|_alex_|dpkg" ~/Amethyst_9-11-2007_processus_et_thread.txt
- --- Topic for #debian is 4.0r1 released /msg dpkg etch | /msg dpkg etch->lenny | PUBLIC KEY NOT AVAILABLE? /msg dpkg no public key | THIS IS NOT #ubuntu | FAQ: http://wiki.debian.org/DebianIRC | /msg dpkg bts | NO FLOOD: USE #flood or /msg dpkg paster | /msg bots NOT people | No updates running at the moment: http://lists.debian.org/debian-devel-announce/2007/11/msg00001.html
- -ChanServ- [#debian] Welcome to #Debian. This is a discussion channel; if you have a question about Debian GNU/Linux, ask and we will try our best to answer it. Newcomers should read the channel's guidelines by typing "/msg dpkg guidelines". Please do not paste in the channel; use #flood instead. Thank you.
- <_AleX_> hi all. "ps aux" or "ps -ef" show all process, right ? so how to explain that ? : http://pastebin.com/m11677576
- <eeanm> _AleX_: 9136 != 9135
- <\amethyst> _AleX_: pstree is probably showing threads too
- <_AleX_> \amethyst: and threads as PID ?
- <\amethyst> _AleX_: yes, that's it
- <\amethyst> _AleX_: { } indicates a thread
- <_AleX_> s/as/have/
- <\amethyst> _AleX_: and it shows thread ID there
- <_AleX_> \amethyst: i don't know the existence of TID (Thread ID) :-)
- <\amethyst> _AleX_: look at ps -eTf It's the SPID column there
- <\amethyst> _AleX_: also known as TID and LWP
- <\amethyst> _AleX_: ps -ef only shows one thread per process; -T or -L show them all
- <_AleX_> \amethyst: http://pastebin.com/m439cd1de
- <\amethyst> _AleX_: yes.. 9136 is a thread ID but not a process ID, so it only shows up in ps -eTf not ps -ef
- <\amethyst> _AleX_: man gettid has some information from a programmer's perspective
- <_AleX_> \amethyst: apparently, PID and TID are unique. you know why ?
- <\amethyst> _AleX_: What do you mean�
- <\amethyst> _AleX_: Identifiers are supposed to be unique, that's what makes them identifiers :)
- <\amethyst> qrck: getty
- <qrck> \amethyst: is it hardcoded or where can i change that value ?
- <qrck> \amethyst: for colorizing or so...
- <_AleX_> \amethyst: TIP of the first process is PID+1, second PID+2 ... and the next process PID don't use a used TID ? http://pastebin.com/m7f57d70e
- <_AleX_> \amethyst: http://pastebin.com/m28b8f161
- <_AleX_> \amethyst: PPID = 1 for all threads mean that the parent is init (PID 1) ?
- <\amethyst> _AleX_: yes
- <\amethyst> _AleX_: which means the process's real parent has died
- <\amethyst> _AleX_: some processes do that intentionally by double-forking and letting the middle process exit(2)
- <_AleX_> \amethyst: I've just start kmail :-)
- <dpkg> Yeah, I have an idea! But I'll need a bag full of herring, a little WD-40, and 42 starving weasels. And keep the NSA off my back for the next few hours!
- <_AleX_> \amethyst: I understand ... and the result of the double-forking technique is that the PID of the process and threads are directly run by init
- <\amethyst> _AleX_: yes, when the middle process exits, its children are inherited by init
- <\amethyst> _AleX_: also, as you can see from the TTY column, it gave up its controlling terminal (if it ever had one)
- <\amethyst> _AleX_: giving up the controlling terminal and double-forking are parts of the standard daemonization procedure
- <\amethyst> !daemon
- <dpkg> from memory, daemon is process that runs in the background attending to various tasks without human intervention, or "Disk And Execution MONitor". Daemons typically have no controlling terminal; see http://www.steve.org.uk/Reference/Unix/faq_2.html#SEC16 for details on implementing a daemon.
- <_AleX_> \amethyst: I've launched kmail by clicking on an desktop icon, so tty = ? is normal (I suppose)
- <_AleX_> \amethyst: very interesting discussion ;-)
- <_AleX_> \amethyst: if you're ok, i will save the buffer of xchat and put it on pastebin (forever post) ... and later i'll translate it in french and add to http://fr.wikibooks.org/wiki/Le_syst%A8me_d%27exploitation_GNU-Linux in the "Processus" page
- <_AleX_> I take this opportunity to pass a message to people who speak French : come help us in the redaction of this document
- <\amethyst> _AleX_: no problem :)
- <_AleX_> j'en profite pour passer un message aux personnes parlant francais : n'h�sitez pas � venir nous aider � la r�daction de ce document
- <stew> _AleX_: what are you doing?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement