Difference Between Child THREAD And Child PROCESS

Hello,

I am troubleshooting something and I got this problem.

If I do "pstree -p"

It shows,

Code:
        ├─soffice.bin(7734)─┬─{soffice.bin}(7735)
        │                   ├─{soffice.bin}(7736)
        │                   ├─{soffice.bin}(7737)
        │                   └─{soffice.bin}(7743)

However, it does NOT show up in "ps -elf"

Code:
ps -elf | grep soffi
0 S whho      7734     1  0  80   0 - 36435 -      11:14 pts/2    00:00:03 /usr/lib/openoffice/program/soffice.bin -splash-pipe=5
0 S whho      7833  7759  0  80   0 -   751 -      11:21 pts/3    00:00:00 grep soffi

I was wondering if 7735, 7736, 7737, 7743 were really processes. Then I checked /proc, I could cd to /proc/7735, /proc/7736, etc, but I could not ls them out.

I looked at the man page of "pstree", it says,

Code:
Child threads  of a process are found under the parent process and are shown with the process name in curly braces, e.g.

           icecast2---13*[{icecast2}]

So, what does all this mean? Does it mean that 7735, 7736, 7737, 7743 are just threads but not processes? If so, why could I cd to /proc/<id> but not see them in "ps -elf".

Would somebody please help me?

Thanks!

whho


Similar Content



Duplicate VG Names And Missing Devices

This has to deal with ubuntu server, but I'm a Linux newbie. Basically talk to me like I'm an 8 year old.

I have a home linux server running Ubuntu server 14.04.2. A few months ago I ran into some trouble with it and long story short only one of the original drives remains and there are two new ones. I'm having a hard time accessing and mounting the logical volumes on the original drive. I'm having issues with the fact that have have volume groups with the same name, as well as missing devices.

Code:
mike@server:~$ lsblk
NAME                             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                                8:0    0   1.8T  0 disk
└─sda3                             8:3    0   1.8T  0 part
sdb                                8:16   0 111.8G  0 disk
├─sdb1                             8:17   0   243M  0 part /boot
├─sdb2                             8:18   0     1K  0 part
└─sdb5                             8:21   0 111.6G  0 part
  ├─server--vg-root (dm-2)       252:2    0  43.4G  0 lvm  /
  └─server--vg-swap_1 (dm-3)     252:3    0   3.2G  0 lvm  [SWAP]
sdc                                8:32   0   1.8T  0 disk
├─server--vg-PrivateMedia (dm-0) 252:0    0  1000G  0 lvm
└─server--vg-PublicMedia (dm-1)  252:1    0   750G  0 lvm

The current boot drive is a 120gb ssd, sdb. sda is a blank 2TB drive that I plan on allocating as necessary to logical volumes. sdc is the has the logical volumes I would like to access.

Code:
mike@server:~$ sudo pvdisplay
  WARNING: Duplicate VG name server-vg: Existing 7MjKjV-5R7c-Qnj1-f3Wh-FR3h-lbom-H4ZEMt (created here) takes precedence over pyCHBp-1KjX-FdhK-hT1V-15uP-7GDn-A1hSRj
  Couldn't find device with uuid QJxFW4-777H-shDs-C2QH-1gWo-Pb0d-56BLPs.
  Couldn't find device with uuid LxIoum-Zjvg-WZ4i-vO8c-ib4O-ldwI-G82TsZ.
  WARNING: Duplicate VG name server-vg: Existing 7MjKjV-5R7c-Qnj1-f3Wh-FR3h-lbom-H4ZEMt (created here) takes precedence over pyCHBp-1KjX-FdhK-hT1V-15uP-7GDn-A1hSRj
  --- Physical volume ---
  PV Name               unknown device
  VG Name               server-vg
  PV Size               465.02 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              119045
  Free PE               119045
  Allocated PE          0
  PV UUID               QJxFW4-777H-shDs-C2QH-1gWo-Pb0d-56BLPs

  --- Physical volume ---
  PV Name               /dev/sdc
  VG Name               server-vg
  PV Size               1.82 TiB / not usable 1.09 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              476932
  Free PE               28932
  Allocated PE          448000
  PV UUID               t1291H-bZqa-8ksX-qYDg-Jix6-CmC3-tVR0qX

  --- Physical volume ---
  PV Name               unknown device
  VG Name               server-vg
  PV Size               465.02 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              119045
  Free PE               119045
  Allocated PE          0
  PV UUID               QJxFW4-777H-shDs-C2QH-1gWo-Pb0d-56BLPs

  --- Physical volume ---
  PV Name               /dev/sdb5
  VG Name               server-vg
  PV Size               111.55 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              28556
  Free PE               16636
  Allocated PE          11920
  PV UUID               ad5UcZ-E7s6-SPg5-RUqL-qitV-qJ5t-XHFr0Q

I've tried vgrename and vgreduce to no avail. I'm not really sure what else I can do. Any help would be greatly appreciated.

Having Problem While Inserting New Enteries In Csv File

Hi Experts,

I am trying to make new enteries in a csv file in new column but am not able to do so.Please help for the same.

Requirement:

There are multiple directories & within those directories i have sub-directories and i want to build a csv file with 2 columns of Directories mapped to their sub-directories. Can you please help me with this. I tried the following code:

Code:
#!/bin/bash

homeDir="$HOME"



ls ~/Parent/ | cut -c1-9 > ~/test_111.csv

while read Child

do

Entry="$(ls $homeDir/Parent/$Child/ABC/XYZ/DEF/PQR)"

echo $Entry

for (( c=1; c<=5; c++ ))

do



sed -i ci"$Entry" test_222.csv

done


done < test_111.csv

Basically i want two columns of csv file , First column should have Child name & Second cloumn should have Sub-Directory name inside PQR Directory.

Any help will be useful on this.

Thanks in Advance!

Best Regards,
Vijay Bhatia

How To Share The Same Code Segment Between Two Processes Using Mmaps?

Hi Experts:

I'm new to Linux,recently i was confused with the words as below:

"To achieve sharing,the process A mmaps the executable file of process B into into the virtual address space of process A. As the Linux loader maps the executable files into the process when executing them,the two processes share the memory image of the mapped file"

questions:
1,What are the "executable files",are they ELF files?
2,How to do "mmaps"?if process A and process B share the same code segment, ,where is process A's own code segment?


Thank you in advance.

Awk - Process A Set Of Records If Field $5 Of Line 01 Is 'W', Otherwise Copy Set To O

Hi guys,

I am looking to write a script where I need to process many sets of transactions.
I want to process the set if $ 1 == "01" field $5 = "W", and $ 1 == "07" field $3 = "YY" otherwise copy set to output.

Example of the input file:

Code:
01 08 77 78  W  9890
02 08 66 68 0 8554
07 08  YY  85 9 7545
01 08 99 87 X 8787
04 09 85 85 4 8758
09 87 88 78 7 6584
10 84 ZZ 99 8 9887

A new set is always starting with $1 == "01".
Script should only process first set because its 5th value is "W" and put "MATCHED" in the end.
and copy the unmatched set "X" as it is to output.

Code:
Example of output file:
 01 08 77 78 W 9890
02 08 66 68 0 8554
07 08 YY 85 9 7545
MATCHED 
 01 08 99 87 X 8787
04 09 85 85 4 8758
09 87 88 78 7 6584
10 84 ZZ 99 8 9887 

and so on..
thanks for your help

Changing The Output Of CPU And RAM Usage

I am using the following two commands to output CPU and RAM usage on a Linux machine.

Code:
/bin/grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'

/usr/bin/free | grep Mem | awk '{print $3/$2 * 100.0 "%"}'

My problem is that the output is like this

Quote:
5.33672%
13.9723%
Is there a way to output a single number? For example

Quote:
5
13
Thank you

Rsync, Reliable "copy And Paste" Type Of Backup In Case Things Break?

What I did in windows was create images of my drive and restore them.

in linux I am running

Code:
rsync -aAXv --exclude={"/home/*","/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /path/to/backup/folder

and this creates a folder for me with all my files, and apparently saves meta data like permissions and paths...

Since I'm using arch and things break sometimes,I'm booted into a CLI with errors and cannot figure my way out since I'm a noob... would I be able to just delete my entire root and replace it with the rsync backup without a problem?

Inetd Listening But No Connection (ftp/Telnet)

Hello,

I try to use a ftp daemon and a Telnet daemon with inetd and the BusyBox v1.19.0 on a linux 2.6.24.

When running inetd and then checking what is listening with "netstat -an |grep LISTEN" i have :
Code:
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN

ftp port 21 and Telnet port 23 seems to be listening.

My inetd.conf file is :

Code:
#<service_name>    <sock_type>    <proto>    <flags> <user>     <server_path>     <args> 

21 stream tcp nowait root ftpd ftpd /etc
telnet            stream        tcp        nowait    root    /usr/sbin/telnetd

I have no rule in my hosts.deny so nothing should be stopped and i have no iptables firewall in place too.

When typing "ftp://ipofthetarget" in a web browser i have a error :

Code:
504 Gateway Timeout
Gateway timeout expired while waiting for server response.

And when trying to Telnet from another computer or "Telnet localhost" from the board i have :
Code:
# telnet 10.2.29.201
Trying 10.2.29.201...
connected to 10.2.29.201.
Escape character is '^]'

Connection closed by foreign host.

This would mean that the connection for Telnet exist but why is it closing ?

Thank you for your future answers !

UPDATE 1 :
If i try to run telnetd like this :
/usb/sbin/telnet -l /bin/sh
i can connect anonymously from another computer, not perfect because i would like a user/password but still of use.
The problem with the ftp daemon still exist.

UPDATE 2 :
Trying from Windows cmd or linux terminal : ftp ipofthetarget seems to work
Not perfect because i would like a user/password too but still of use.

I am still open for suggestion for the user/password thing. I am not deleting the thread in case someone interested about this exist.

Problems With Mounting Drive At Boot

Hi,

I have problems mounting my second drive at boot automatically.
(sorry i am a noob)

When i use the mount command, it works fine.
Code:
mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2

But when i try to add one if the following lines to /etc/fstab
It will not mount the drive at boot or with Code:
mount -a

, also fstab is empty afer reboot (normal??)

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults,errors=remount-ro 0 1

Code:
UUID=553afede-fa45-4cdc-9972-c0a9aa899509 /mnt/HD/HD_b2 ext3 errors=remount-ro 0 1

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw 0 0

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults 0 1

output blkid:

Code:
/dev/sda1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sda2: UUID="09e0e365-0aa6-4214-b571-2bc6b027fd9f" TYPE="ext3"
/dev/sda4: UUID="64038414-136c-4939-bd14-9871a20290bd" TYPE="ext3"
/dev/sdb1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sdb2: UUID="553afede-fa45-4cdc-9972-c0a9aa899509" TYPE="ext3"
/dev/sdb4: UUID="bf594be6-ffb6-469d-a3a8-246be66a4d90" TYPE="ext2"

/etc/mtab:

Code:
rootfs / rootfs rw 0 0
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,relatime 0 0
proc /proc proc rw,relatime 0 0
squash /usr/local/tmp ramfs rw,relatime,size=38m 0 0
/dev/loop0 /usr/local/modules squashfs ro,relatime 0 0
/dev/mtdblock5 /usr/local/config jffs2 rw,relatime 0 0
/dev/sda4 /mnt/HD_a4 ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw,relatime,errors=continue 0 0
none /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda2 /mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sda2 /mnt/HD/HD_a2/squeeze/mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,u$
/dev/root /mnt/HD/HD_a2/squeeze/mnt/root ext2 rw,relatime,errors=continue 0 0
/dev/root /mnt/HD/HD_a2/squeeze/dev ext2 rw,relatime,errors=continue 0 0
sysfs /mnt/HD/HD_a2/squeeze/sys sysfs rw,relatime 0 0
proc /mnt/HD/HD_a2/squeeze/proc proc rw,relatime 0 0

When mount command is used Code:
mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2

The following line is added to mstab -->
Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw 0 0

I diont know what i am doing wrong, mount for HD_a2 works fine (other disk, worked at default), i hav e NAS DNS-325 where i installed Debian on. I used this tutorial to install debian.

The strange thing is, i had to reinstall my NAS, and befor it worked fine after i had installed debian 2 years ago, i just dont remeber how i fixed this.

Space Disk "used" In Df Is Nowhere To Be Found With Du

Hello,

I am facing an issue with a filesystem (/dev/sda3); I see space used on it (around 365GB) when I am looking at the host with "df -h" command.

Code:
[root@srv_omega /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             443G  365G   56G  87% /
tmpfs                  95G   56K   95G   1% /dev/shm
/dev/sda1             484M   39M  421M   9% /boot
/dev/sdb1             3.6T  1.3T  2.2T  36% /hadoop/disk1
/dev/sdc1             3.6T  1.3T  2.2T  37% /hadoop/disk2
/dev/sdd1             3.6T  1.3T  2.2T  36% /hadoop/disk3
/dev/sde1             3.6T  1.3T  2.2T  37% /hadoop/disk4
/dev/sdf1             3.6T  1.3T  2.2T  36% /hadoop/disk5
/dev/sdg1             3.6T  1.3T  2.2T  36% /hadoop/disk6
/dev/sdh1             3.6T  1.3T  2.2T  36% /hadoop/disk7
/dev/sdi1             3.6T  1.3T  2.2T  36% /hadoop/disk8
/dev/sdj1             3.6T  1.3T  2.2T  36% /hadoop/disk9
/dev/sdk1             3.6T  1.3T  2.2T  36% /hadoop/disk10
/dev/sdl1             3.6T  1.2T  2.3T  36% /hadoop/disk11
/dev/sdm1             3.6T  1.3T  2.2T  36% /hadoop/disk12
/dev/sdn1             3.6T  1.3T  2.2T  36% /hadoop/disk13
/dev/sdo1             3.6T  1.3T  2.2T  37% /hadoop/disk14
/dev/sdp1             3.6T  1.1T  2.4T  30% /hadoop/disk15
cm_processes           95G  8.2M   95G   1% /var/run/cloudera-scm-agent/process

I have looked if any hidden file might cause the issue, no joy.

Code:
[root@srv_omega /]# pwd
/
[root@srv_omega /]#  ls -lrtha
total 121K
drwxr-xr-x    2 root root 4.0K Jun 28  2011 srv
drwxr-xr-x    2 root root 4.0K Jun 28  2011 mnt
drwxr-xr-x    2 root root 4.0K Jun 28  2011 media
drwxr-xr-x    2 root root 4.0K Dec 20  2012 cgroup
drwx------    2 root root  16K Jun  2  2014 lost+found
drwxr-xr-x    2 root root 4.0K Jun  2  2014 selinux
-rw-r--r--    1 root root    0 Jun  3  2014 .autorelabel
drwxr-xr-x   18 root root 4.0K Jun  5  2014 hadoop
drwxr-xr-x   21 root root 4.0K Jun  5  2014 var
dr-xr-xr-x    9 root root  12K Jun 20  2014 lib64
dr-xr-xr-x    2 root root  12K Jun 21  2014 sbin
dr-xr-xr-x    2 root root 4.0K Jun 21  2014 bin
dr-xr-xr-x    5 root root 1.0K Jun 22  2014 boot
dr-xr-x---    5 root root 4.0K Jun 22  2014 root
drwxr-xr-x    6 root root 4.0K Jun 22  2014 opt
drwxr-xr-x    3 root root 4.0K Dec 10 19:11 home
dr-xr-xr-x   13 root root 4.0K Dec 12 16:18 lib
dr-xr-xr-x 1140 root root    0 Apr 30 15:11 proc
drwxr-xr-x   13 root root    0 Apr 30 15:11 sys
-rw-r--r--    1 root root    0 Apr 30 15:11 .autofsck
drwxr-xr-x    2 root root    0 Apr 30 15:11 misc
drwxr-xr-x    2 root root    0 Apr 30 15:11 net
drwxr-xr-x   15 root root 4.0K Apr 30 15:12 usr
drwxr-xr-x   19 root root 4.6K Apr 30 15:12 dev
dr-xr-xr-x   27 root root 4.0K Apr 30 15:12 ..
dr-xr-xr-x   27 root root 4.0K Apr 30 15:12 .
drwxr-xr-x  122 root root  12K May  4 03:33 etc
drwxrwxrwt   16 root root 4.0K May  7 06:14 tmp

So I try to find where the space is used with a "du -sh" command

Code:
[root@srv_omega /]# pwd
/
[root@srv_omega /]# du -sh *
7.8M    bin
29M     boot
4.0K    cgroup
280K    dev
26M     etc
19T     hadoop
124K    home
144M    lib
26M     lib64
16K     lost+found
4.0K    media
0       misc
4.0K    mnt
0       net
7.9G    opt
du: cannot access `proc/9170/task/27326/fdinfo/538': No such file or directory
du: cannot access `proc/45119/task/45119/fd/4': No such file or directory
du: cannot access `proc/45119/task/45119/fdinfo/4': No such file or directory
du: cannot access `proc/45119/fd/4': No such file or directory
du: cannot access `proc/45119/fdinfo/4': No such file or directory
du: cannot access `proc/45160': No such file or directory
0       proc
3.8M    root
17M     sbin
4.0K    selinux
4.0K    srv
0       sys
3.9M    tmp
2.6G    usr
16G     var

So as far as I understand, only /hadoop is a suitable suspect (as cumulative size of all the other folders on "/" are well below the 365GB)

Code:
[root@srv_omega hadoop]# cd /
[root@srv_omega /]# cd /hadoop
[root@srv_omega hadoop]# ls -lrtha
total 72K
drwxr-xr-x  2 root root 4.0K Jun  5  2014 disk16
drwxr-xr-x 18 root root 4.0K Jun  5  2014 .
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk1
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk11
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk10
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk13
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk12
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk14
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk2
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk4
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk3
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk6
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk5
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk8
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk7
drwxr-xr-x  4 root root 4.0K Jun 22  2014 disk9
drwxr-xr-x  5 root root 4.0K Nov 19 20:02 disk15
dr-xr-xr-x 27 root root 4.0K Apr 30 15:12 ..

All folders from 1 to 15 are on different filesystems, so the folder disk16 seems to be the only option but there is nothing in it.

Code:
[root@srv_omega hadoop]# cd disk16/
[root@srv_omega disk16]# ls -lrtha
total 8.0K
drwxr-xr-x 18 root root 4.0K Jun  5  2014 ..
drwxr-xr-x  2 root root 4.0K Jun  5  2014 .
[root@srv_omega disk16]#

I just don't get it; no folder seems responsible for the "365Gb"...

Any idea on how I could try to find out where those "365GB" are ?

Kill Zombie Process Via C Program Without Killing Main Process

Hi ,
In my program, for a process A executing operation, there are multiple threads created.
One of the thread A checks whether process is active or not
Second thread B executes a function
One of the periodic thread C calls a callback function that executes an audit after every 30 secs.

In the audit , the function uses g_spawn_commmand_line_sync() function to spawn a child process that executes a command line (shell script).

Since g_spawn_commmand_line_sync() spawns a new child process .
In the error case scenario, the spawned child process got stuck and became zombie process. It did not get killed.Also it acquired sockets which were assigned to a thread B executing operation.

Even though the thread B got terminated ,the child process did not release the sockets that were connected to it.


My question is ,I have to automate this in C program that if it finds spawned process of g_spawn_commmand_line_sync() defunct, the
health check thread B should be able to clean it without klling the main process.

i could not find any spawn function that will help me find the PID of g_spawn_commmand_line_sync() spawned process.

I get the details from ps commands. But how can I find it in a c-program?