3

While reading about Linux, I got a $netstat -tulpn to find out which process is listening Upon a port. I got:

anupam@JAZZ:~$ sudo netstat -tulpn
[sudo] password for anupam: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1827/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1992/cupsd      
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      976/mysqld      
tcp6       0      0 :::80                   :::*                    LISTEN      1342/apache2    
tcp6       0      0 ::1:631                 :::*                    LISTEN      1992/cupsd      
tcp6       0      0 :::3689                 :::*                    LISTEN      2582/rhythmbox  
udp        0      0 0.0.0.0:631             0.0.0.0:*                           943/cups-browsed
udp        0      0 0.0.0.0:37759           0.0.0.0:*                           697/avahi-daemon: r
udp        0      0 0.0.0.0:58502           0.0.0.0:*                           1822/dhclient   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           3039/chromium-brows
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           697/avahi-daemon: r
udp        0      0 127.0.1.1:53            0.0.0.0:*                           1827/dnsmasq    
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1822/dhclient   
udp6       0      0 :::5353                 :::*                                697/avahi-daemon: r
udp6       0      0 :::44452                :::*                                697/avahi-daemon: r
udp6       0      0 :::16540                :::*                                1822/dhclient   

There is a single PID for googleChromium, while I have opened multiple windows and multiple tabs in it. I read that chromium uses processes rather than threads http://blog.chromium.org/2008/09/multi-process-architecture.html, as port numbers are used for application to application connection (so I understand that there is a single PID for chromium). But what about PIDs for other processes associated with Chromium??

5

The Chromium browser indeed uses different processes to render your opened tabs:

$ps -aef
[...]
sylvain   6432  2223 20 11:19 ?        00:00:02 chromium-browser --enable-pinch                          
sylvain   6441  6432  0 11:19 ?        00:00:00 /usr/lib/chromium-browser/chrome-sandbox /usr/lib/chromium-browser/chromium-browser --type=zygote
sylvain   6442  6441  1 11:19 ?        00:00:00 chromium-browser --type=zygote                          
sylvain   6446  6442  0 11:19 ?        00:00:00 chromium-browser --type=zygote                          
sylvain   6469  6432  8 11:19 ?        00:00:00 chromium-browser --type=gpu-process --channel=6432.0.2058149686 --supports-dual-gpus=false --gpu-driver-bug-workarounds=1,11,13,15 --disable-accelerated-video-decode --gpu-vendor-
sylvain   6489  6446  1 11:19 ?        00:00:00 /usr/lib/chromium-browser/chro                          
sylvain   6509  6469  0 11:19 ?        00:00:00 chromium-browser --type=gpu-broker                                                                                                                                                 
root      6516     2  0 11:19 ?        00:00:00 [kworker/0:0]
sylvain   6517  6446 10 11:19 ?        00:00:00 /usr/lib/chromium-browser/chro                          
sylvain   6541  6446  5 11:20 ?        00:00:00 /usr/lib/chromium-browser/chro 

In the above example pid 6517 and 6541 are my opened tabs, but like you netstat only returns one network process for Chromium (6432):

$ sudo netstat -tulpn
[sudo] password for sylvain: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1966/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      3804/cupsd      
tcp        0      0 0.0.0.0:538             0.0.0.0:*               LISTEN      1363/gdomap     
tcp6       0      0 ::1:631                 :::*                    LISTEN      3804/cupsd      
udp        0      0 0.0.0.0:45410           0.0.0.0:*                           2158/dhclient   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           6432/chromium-brows
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           933/avahi-daemon: r
udp        0      0 127.0.1.1:53            0.0.0.0:*                           1966/dnsmasq    
udp        0      0 0.0.0.0:68              0.0.0.0:*                           2158/dhclient   
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1715/dhclient   
udp        0      0 192.168.1.36:123        0.0.0.0:*                           2956/ntpd       
udp        0      0 192.168.1.40:123        0.0.0.0:*                           2956/ntpd       
udp        0      0 127.0.0.1:123           0.0.0.0:*                           2956/ntpd       
udp        0      0 0.0.0.0:123             0.0.0.0:*                           2956/ntpd       
udp        0      0 0.0.0.0:49400           0.0.0.0:*                           933/avahi-daemon: r
udp        0      0 0.0.0.0:538             0.0.0.0:*                           1363/gdomap     
udp        0      0 0.0.0.0:631             0.0.0.0:*                           1187/cups-browsed
udp        0      0 0.0.0.0:10080           0.0.0.0:*                           1715/dhclient   
udp6       0      0 :::60417                :::*                                933/avahi-daemon: r
udp6       0      0 :::5353                 :::*                                933/avahi-daemon: r
udp6       0      0 :::47845                :::*                                2158/dhclient   
udp6       0      0 :::8012                 :::*                                1715/dhclient   
udp6       0      0 fe80::3ea9:f4ff:fe1:123 :::*                                2956/ntpd       
udp6       0      0 fe80::3e97:eff:fe81:123 :::*                                2956/ntpd       
udp6       0      0 ::1:123                 :::*                                2956/ntpd       
udp6       0      0 :::123                  :::*                                2956/ntpd  

So why?

  • Chromium uses a multi-process architecture, which isolates render processes from the browser process but...
  • Chromium maintains a single instance of the resource dispatcher, which is shared across all render processes, and runs within the browser kernel process.
  • Each render process communicates with the resource dispatcher via IPC.

Sources:

2
  • thanx @Sylvain Pineau,, well Is chromium-browser --enable pinch default network process for all chromium because I got the same.
    – lazarus
    Sep 21 '14 at 10:26
  • 1
    @jazzz --enable-pinch is used to enable compositor-accelerated touch-screen pinch gestures. I don't think it's related. Since it's the first created process I guess that this one provides the Chromium kernel process. Sep 21 '14 at 10:33
1

You can use pgrep -P 3039 to get all the child process IDs of Chromium. Then you can use ps -p "$child_pids" to get information about them. Or use ps --ppid 3039 directly.

1
  • Thanx @lObO ,I got it.
    – lazarus
    Sep 21 '14 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.