RE: PS output for threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 


On Fri, 26 May 2006 Abu M.Muttalib wrote :
>Hi Tayseer,
>
>Thanks for your reply.
>
>The log shows new PID for different thread, but threads/process marked in
>red color have different PPID, why this is so?

This is beacuse if you notice
The process with PPID = 1 has the lowest PID number

What does this imply?
  - It states that this a process which is say ... started by a shell ..  and this is the process which starts other threads ...

Infact if you see the output of PS correctly ....

process with PID = 872 spawns process with PID = 874 and this process then starts spawning the other threads ...

Please CMIIW ....




>
>My main question remained unanswered: Are the processes with the same name
>represent threads? Is there a direct correlation between no of threads
>created and no shown in the output of ps?

Yes there is ...  I hope my above explanation also explains this query

- Rohit
>
>Regards,
>Abu.
>Abu M. Muttalib
>Associate,
>Aftek Infosys Ltd.,
>Pune, India
>Office: 91-20-25449260-65 X-254
>Email: abum@xxxxxxxxx
>
>
>
>  -----Original Message-----
>  From: MHD.Tayseer Alquoatli [mailto:idoit.ief@xxxxxxxxx]
>  Sent: Friday, May 26, 2006 12:42 PM
>  To: Abu M. Muttalib
>  Cc: kernelnewbies@xxxxxxxxxxxx
>  Subject: Re: PS output for threads
>
>
>
>
>
>  On 5/26/06, Abu M. Muttalib <abum@xxxxxxxxx> wrote:
>    Hi Tayseer,
>
>  Hi Abu
>  http://en.wikipedia.org/wiki/Top_posting
>
>
>
>    I don't agree with that. For any thread there will be a new task struct,
>and hence there will be new process ID and all.
>
>  This is true .. but this is now what i've said
>  for each new threads there will be a new task, new process id "pid", all
>threads have the same parent id "ppid" and the same process group id "pgid"
>and this is what is shown in your log
>  "Linux doesn't differentiate between processes and threads cause they all
>are tasks" i mean that both processes and threads will be presented by a
>task struct
>  CMIIW please
>
>  thanks
>
>
>    for example I have the following log:
>
>      PID USER    STATUS  RSS  PPID %CPU %MEM COMMAND
>      942 yoku    R        828  871  1.9  5.7 busybox
>      834 yoku    S      2620    1  0.0 18.3 hopper
>      891 yoku    S      2620  890  0.0 18.3 hopper
>      890 yoku    S      2620  834  0.0 18.3 hopper
>      871 yoku    S      1340    1  0.0  9.3 sh
>      875 yoku    S      1336  874  0.0  9.3 Angelia
>      872 yoku    S      1336    1  0.0  9.3 Angelia
>      887 yoku    S      1336  874  0.0  9.3 Angelia
>      888 yoku    S <    1336  874  0.0  9.3 Angelia
>      876 yoku    S      1336  874  0.0  9.3 Angelia
>      884 yoku    S      1336  874  0.0  9.3 Angelia
>      885 yoku    S      1336  874  0.0  9.3 Angelia
>      874 yoku    S      1336  872  0.0  9.3 Angelia
>      883 yoku    S      1336  874  0.0  9.3 Angelia
>      886 yoku    S      1336  874  0.0  9.3 Angelia
>      766 yoku    S      1092    1  0.0  7.6 SIMSCRIPT1
>      767 yoku    S      1092    1  0.0  7.6 SIMSCRIPT2
>      836 yoku    S        800    1  0.0  5.5 btsdpd
>      811 yoku    S        712    1  0.0  4.9 btsrv
>
>    Regards,
>    Abu.
>    Abu M. Muttalib
>    Associate,
>    Aftek Infosys Ltd.,
>    Pune, India
>    Office: 91-20-25449260-65 X-254
>    Email: abum@xxxxxxxxx
>
>
>
>    -----Original Message-----
>    From: MHD.Tayseer Alquoatli [mailto:idoit.ief@xxxxxxxxx]
>    Sent: Friday, May 26, 2006 11:58 AM
>    To: Abu M. Muttalib
>    Cc: kernelnewbies@xxxxxxxxxxxx
>    Subject: Re: PS output for threads
>
>
>
>
>
>    On 5/25/06, Abu M. Muttalib <abum@xxxxxxxxx> wrote:
>      Hi,
>
>      I have an application wherein I have say 10 threads which are created
>      unconditionally and run a "while(1);".
>
>      Will they be shown in the output of ps -A as 10 different processes?
>
>    Hi
>    cause Linux don't differentiate between process and a threads .. they
>are all tasks
>    all your threads have the same parent process id "ppid" and share the
>same process group id "pgid"
>    hope this helps
>
>
>    --
>    MHD.Tayseer
>
>
>
>  --
>  MHD.Tayseer




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux