Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

alex

a guest Nov 9th, 2007 331 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. $ ps -ef |grep kmail
  2. alex      9135     1  5 21:41 ?        00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
  3. 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
  4. alex      9462  5410  0 21:44 pts/0    00:00:00 grep kmail
  5. $ ps aux |grep kmail
  6. alex      9135  4.7 12.5 313560 259672 ?       Sl   21:41   0:09 kmail -caption KMail -icon kmail -miniicon kmail
  7. 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
  8. alex      9464  0.0  0.0   2884   804 pts/0    S+   21:44   0:00 grep kmail
  9. $ pstree -p|grep kmail
  10.         |-kmail(9135)-+-ispell(9145)
  11.         |             |-{kmail}(9136)
  12.         |             |-{kmail}(9137)
  13.         |             |-{kmail}(9138)
  14.         |             `-{kmail}(9139)
  15. $ ps -ef |grep 9136
  16. alex      9477  5410  0 21:45 pts/0    00:00:00 grep 9136
  17. $ ps aux |grep 9136
  18. alex      9479  0.0  0.0   2876   788 pts/0    S+   21:45   0:00 grep 9136
  19. $ pstree -p|grep kmail
  20.         |-kmail(9135)-+-ispell(9145)
  21.         |             |-{kmail}(9136)
  22.         |             |-{kmail}(9137)
  23.         |             |-{kmail}(9138)
  24.         |             `-{kmail}(9139)
  25.  
  26. ##################################### mystery resolved by \amethyst ##################################
  27. ps -eTf | grep kmail
  28. alex      9135  9135     1  1 21:41 ?        00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
  29. alex      9135  9136     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  30. alex      9135  9137     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  31. alex      9135  9138     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  32. alex      9135  9139     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  33. alex      9552  9552  5410  0 21:51 pts/0    00:00:00 grep kmail
  34.  
  35.  
  36. ######################################## TIP of the first process is PID+1, second PID+2 ? ######################################
  37. $ ps -eTf | awk '{print $2, $9}'
  38. ...
  39. 8595 scribus
  40. 9135 kmail
  41. 9135 kmail
  42. 9135 kmail
  43. 9135 kmail
  44. 9135 kmail
  45. 9145 ispell
  46. 9146 ispell
  47. 9147 ispell
  48. 9150 ispell
  49. 9151 ispell
  50. 9152 ispell
  51. 9154 ispell
  52. 9155 ispell
  53. 9156 ispell
  54. 9162 ispell
  55. 9163 ispell
  56. 9165 ispell
  57. 9166 ispell
  58. 9167 ispell
  59. 9168 ispell
  60. 9169 ispell
  61. 9170 ispell
  62. 9171 ispell
  63. 9172 ispell
  64. 9173 ispell
  65. 9174 ispell
  66. 9175 ispell
  67. 9176 ispell
  68. 9640 smtpd
  69. ...
  70.  
  71. ##################################### I've understand ! ###############################################
  72. $ ps -eTf | head -1 ; ps -eTf | grep kmail
  73. UID        PID  SPID  PPID  C STIME TTY          TIME CMD
  74. alex      9135  9135     1  0 21:41 ?        00:00:09 kmail -caption KMail -icon kmail -miniicon kmail
  75. alex      9135  9136     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  76. alex      9135  9137     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  77. alex      9135  9138     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  78. alex      9135  9139     1  0 21:41 ?        00:00:00 kmail -caption KMail -icon kmail -miniicon kmail
  79. alex      9732  9732  5410  0 22:10 pts/0    00:00:00 grep kmail
  80.  
  81. This is the same PID, and the SPID use PID++
  82.  
  83. But a question : PPID = 1 for all threads mean that the parent is init (PID 1) ?
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. ================================= The discussion with \amethyst on #debian - Freenode ===================================
  91. $ egrep -i "amethyst|_alex_|dpkg" ~/Amethyst_9-11-2007_processus_et_thread.txt
  92. --- 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
  93. -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.
  94. <_AleX_> hi all. "ps aux" or "ps -ef" show all process, right ? so how to explain that ? : http://pastebin.com/m11677576
  95. <eeanm> _AleX_: 9136 != 9135
  96. <\amethyst> _AleX_: pstree is probably showing threads too
  97. <_AleX_> \amethyst: and threads as PID ?
  98. <\amethyst> _AleX_:  yes, that's it
  99. <\amethyst> _AleX_:  { } indicates a thread
  100. <_AleX_> s/as/have/
  101. <\amethyst> _AleX_:  and it shows thread ID there
  102. <_AleX_> \amethyst: i don't know the existence of TID (Thread ID) :-)
  103. <\amethyst> _AleX_:   look at  ps -eTf   It's the SPID column there
  104. <\amethyst> _AleX_:  also known as TID and LWP
  105. <\amethyst> _AleX_:  ps -ef only shows one thread per process; -T or -L show them all
  106. <_AleX_> \amethyst: http://pastebin.com/m439cd1de
  107. <\amethyst> _AleX_:  yes.. 9136 is a thread ID but not a process ID, so it only shows up in ps -eTf not ps -ef
  108. <\amethyst> _AleX_:  man gettid  has some information from a programmer's perspective
  109. <_AleX_> \amethyst: apparently, PID and TID are unique. you know why ?
  110. <\amethyst> _AleX_:  What do you mean¿
  111. <\amethyst> _AleX_:  Identifiers are supposed to be unique, that's what makes them identifiers :)
  112. <\amethyst> qrck:  getty
  113. <qrck> \amethyst: is it hardcoded or where can i change that value ?
  114. <qrck> \amethyst: for colorizing or so...
  115. <_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
  116. <_AleX_> \amethyst: http://pastebin.com/m28b8f161
  117. <_AleX_> \amethyst: PPID = 1 for all threads mean that the parent is init (PID 1) ?
  118. <\amethyst> _AleX_: yes
  119. <\amethyst> _AleX_:  which means the process's real parent has died
  120. <\amethyst> _AleX_:  some processes do that intentionally by double-forking and letting the middle process exit(2)
  121. <_AleX_> \amethyst: I've just start kmail :-)
  122. <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!
  123. <_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
  124. <\amethyst> _AleX_:  yes, when the middle process exits, its children are inherited by init
  125. <\amethyst> _AleX_:  also, as you can see from the TTY column, it gave up its controlling terminal (if it ever had one)
  126. <\amethyst> _AleX_:  giving up the controlling terminal and double-forking are parts of the standard daemonization procedure
  127. <\amethyst> !daemon
  128. <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.
  129. <_AleX_> \amethyst: I've launched kmail by clicking on an desktop icon, so tty = ? is normal (I suppose)
  130. <_AleX_> \amethyst: very interesting discussion ;-)
  131. <_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
  132. <_AleX_> I take this opportunity to pass a message to people who speak French :  come help us in the redaction of this document
  133. <\amethyst> _AleX_:  no problem :)
  134. <_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
  135. <stew> _AleX_: what are you doing?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top