You are not logged in.

#1 2008-07-30 05:09:33

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

multiple instances of mpd

Whenever I start mpd, after a little while I have 3 instances of it. I don't know why. Can someone tell me how this whole thing works for my understanding?

Here's my ps_mem.py and also the pidof mpd

inxs ~ > sudo python ps_mem.py 
Password: 
 Private  +   Shared  =  RAM used    Program 

  0.0 KiB +  14.0 KiB =  14.0 KiB    udevd
  8.0 KiB +  14.5 KiB =  22.5 KiB    portmap
  4.0 KiB +  23.5 KiB =  27.5 KiB    startx
  4.0 KiB +  24.0 KiB =  28.0 KiB    xinit
  4.0 KiB +  28.0 KiB =  32.0 KiB    dbus-launch
  4.0 KiB +  29.0 KiB =  33.0 KiB    hald-addon-acpi
  0.0 KiB +  33.0 KiB =  33.0 KiB    openbox-session (2)
  4.0 KiB +  34.0 KiB =  38.0 KiB    famd
  4.0 KiB +  39.0 KiB =  43.0 KiB    login
  4.0 KiB +  47.0 KiB =  51.0 KiB    hald-runner
 48.0 KiB +  15.0 KiB =  63.0 KiB    init
  4.0 KiB +  64.0 KiB =  68.0 KiB    hald-addon-dell-backlight
 20.0 KiB +  65.0 KiB =  85.0 KiB    agetty (5)
 80.0 KiB +  19.0 KiB =  99.0 KiB    crond
 60.0 KiB +  42.0 KiB = 102.0 KiB    hald-addon-storage
 64.0 KiB +  45.0 KiB = 109.0 KiB    hald-addon-input
144.0 KiB +  58.5 KiB = 202.5 KiB    sshd
364.0 KiB +  21.0 KiB = 385.0 KiB    syslog-ng
252.0 KiB + 273.0 KiB = 525.0 KiB    dbus-daemon (2)
500.0 KiB + 103.5 KiB = 603.5 KiB    conky
592.0 KiB +  98.0 KiB = 690.0 KiB    hald
  1.1 MiB +  95.0 KiB =   1.2 MiB    bash (2)
  2.1 MiB + 287.5 KiB =   2.4 MiB    openbox
  1.8 MiB +   1.0 MiB =   2.8 MiB    fbpanel
  3.4 MiB + 277.5 KiB =   3.7 MiB    urxvt
  4.0 MiB +   2.6 MiB =   6.7 MiB    mpd (3)
  6.3 MiB +   1.3 MiB =   7.6 MiB    pidgin
 13.9 MiB +   2.6 MiB =  16.5 MiB    sonata
 23.2 MiB +   1.4 MiB =  24.6 MiB    skype
 32.3 MiB + 701.5 KiB =  33.0 MiB    Xorg
 66.5 MiB +   2.0 MiB =  68.6 MiB    firefox
---------------------------------
                        170.3 MiB
=================================

 Private  +   Shared  =  RAM used    Program 

inxs ~ > pidof mpd
10550 10549 10548
inxs ~ >

Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#2 2008-07-30 07:23:21

Dheart
Member
From: Sofia, Bulgaria
Registered: 2006-10-26
Posts: 956

Re: multiple instances of mpd

That's completely normal for mpd, on both of my machines mpd has three processes. I don't know why's that you could question the developers. However I noticed that if I start killing processes there is only one crucial mpd process. I can kill the other two without killing mpd.


My victim you are meant to be
No, you cannot hide nor flee
You know what I'm looking for
Pleasure your torture, I will endure...

Offline

#3 2008-07-30 08:26:31

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: multiple instances of mpd

Mine only has one


neutral

Offline

#4 2008-07-30 08:45:30

nesrecar
Member
From: Germany/Munich
Registered: 2004-06-06
Posts: 79

Re: multiple instances of mpd

% ps aux | grep /usr/bin/mpd | wc -l
1


Public Key 0x24685E35 available from any key server you trust.

IRC: ssimon/Nesrecar

Offline

#5 2008-07-30 10:34:22

mfolnovic
Member
From: Zagreb, Croatia
Registered: 2008-01-03
Posts: 104

Re: multiple instances of mpd

I have 4, lol

Offline

#6 2008-07-30 11:07:56

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: multiple instances of mpd

I also have 3. 'ps aux | grep mpd | wc -l' = 4, but that also counts the grep

Offline

#7 2008-07-30 11:51:42

nesrecar
Member
From: Germany/Munich
Registered: 2004-06-06
Posts: 79

Re: multiple instances of mpd

pseup wrote:

I also have 3. 'ps aux | grep mpd | wc -l' = 4, but that also counts the grep

Not everytime, example:

% ps aux | grep /usr/bin/mpd | wc -l
2
% ps aux | grep /usr/bin/mpd | wc -l
1
% ps aux | grep /usr/bin/mpd | wc -l
2

Just count -1 if it adds grep too


Public Key 0x24685E35 available from any key server you trust.

IRC: ssimon/Nesrecar

Offline

#8 2008-07-30 12:22:32

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: multiple instances of mpd

I think maybe mpd initially did not use threads but rather multiple processes for concurrency. I think right now they are transitioning towards threads (many threads of execution in one process). Um this is info from quickly reading the mpd wiki a long time ago. I may be totally wrong. But for example, I found this with a "grep fork" in the mpd source in decode.c:

/* decode w/ buffering
 * this will fork another process
 * child process does decoding
 * parent process does playing audio
 */
void decode(void)
{
    ob_clear();

    dc.error = DECODE_ERROR_NOERROR;
    dc.seek = 0;
    dc.stop = 0;
    dc.start = 1;
    do { player_wakeup_decoder(); } while (dc.start);

    decodeParent();
}

When I start mpd, it has only one process. After I've issued the "play" command, it has three.

Offline

#9 2008-07-30 14:55:12

tj
Member
Registered: 2008-01-11
Posts: 48

Re: multiple instances of mpd

why not just

ps ax | grep mpd

the suggested

% ps aux | grep /usr/bin/mpd | wc -l

returns on bash

-bash: %: command not found
ps ax | grep mpd | wc -l

gives me 4 but I don't get to see one is the grep and it's of no use to me for killing the process

Last edited by tj (2008-07-30 14:57:10)

Offline

#10 2008-07-30 15:00:22

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 291

Re: multiple instances of mpd

'%' is not a part of the comman. smile

I have 3 instances too. It does not matter if the mpd is playing or not, they are 3.

Offline

#11 2008-07-30 15:47:45

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: multiple instances of mpd

Alright. I am glad everyone has similar number of instances. I thought I was probably instantiating mpd in different places and probably forgot about it.


When I explicitly kill all instances, and then issue the

mpd

command, I have 1 instance according to pidof -- then after some (short) time it becomes 3 instances irrespective of whether I started playing songs or not.

and

ps aux | grep mpd | wc -l

gives me 4

Last edited by Inxsible (2008-07-30 15:48:35)


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB