[mythtv-users] Is this normal?
Michael T. Dean
mtdean at thirdcontact.com
Tue Oct 19 20:53:25 UTC 2004
John Goerzen wrote:
>On Monday 18 October 2004 11:37 pm, Michael T. Dean wrote:
>>Mike Wood wrote:
>>>When I'm watching "live" TV, I see 5-6 instances of mythfrontend in
>>>Top. Only one of them is using significant CPU, but they are all
>>>using the same amount of memory. Is this normal?
>>Linux 2.4 shows threads--not processes--in top and ps output.
>>Therefore, all 5-6 lines showing mythfrontend are actually threads in
>>the same "process" (what you referred to as an instance). The memory
>>used is the total process memory--the values should not be added for
>No, you're confusing the issue. A distinct PID is a distinct PID, no
Unless, of course, you're using Linux 2.4. ;) Straight from the
horse's mouth ( http://procps.sourceforge.net/faq.html ):
Why do ps and top show threads individually?
The 2.4.xx kernel does not provide proper support for grouping threads
by process. Hacks exist to group them anyway, but such hacks will
falsely group similar tasks and will fail to group tasks due to race
conditions. The hacks are also slow. As none of this is acceptable in a
critical system tool, task grouping is not currently available for the
2.4.xx kernel. The 2.6.xx kernel allows for proper thread grouping and
reporting. To take advantage of this, your programs must use a threading
library that features the CLONE_THREAD flag. The NPTL pthreads provided
by recent glibc releases use CLONE_THREAD.
(my words, again)
Note, that as of procps 2.0.8, there is a "hack" in place that looks at
a process's children and compares RSS, VM size, and the process image
being executed. If they are the same, they are labeled threads. Since
this is a hack, it often fails to detect threads appropriately,
resulting in users thinking mythfrontend is eating up 82% of the 512MB
on the system
>How do you know, anyway, that mythfrontend is
Well, if it were a TiVo (or other commercial proprietary package), I
wouldn't, but with Myth, I have the source code... ;)
>In my experience, when mythfrontend apepars to crash, it often leaves
>behind some processes that must be manually killed.
Possible, but--assuming the user hasn't experienced a crash (as the OP
never mentioned a crash)--probably not the problem here.
See end of post for sample results showing the behavior reported.
>>Therefore, it's completely normal.
>>You'll see the same thing with mysqld, httpd, and many other
>>processes on the system.
>httpd, for one, uses fork. It is *not* what you have described; these
>are separate processes.
Yes, but I guarantee that it also uses threads. The problem with Common
Gateway Interface (CGI) web application development was that the
creation of a new process for every request (to execute the
script/program that handled the request) was extremely resource
intensive. Therefore, various techniques for creating web applications
SSI, scripted HTML, etc.) were developed.
From my Linux 2.4 MythTV system with procps 3.2.0 running top, sorting
by "Memory usage (RES)" (n) without watching LiveTV on a system that has
*not* had any crashes since last reboot:
544 mythtv 9 0 100m 20m 6964 S 0.0 4.0 0:40.38 mythfrontend
545 root 8 0 100m 20m 6964 S 0.0 4.0 0:00.05 mythfrontend
547 root 9 0 100m 20m 6964 S 0.0 4.0 0:00.00 mythfrontend
550 root 9 0 100m 20m 6964 S 0.0 4.0 0:00.79 mythfrontend
554 root 9 0 100m 20m 6964 S 0.0 4.0 0:00.01 mythfrontend
Same system, same top, same sorting while watching LiveTV:
544 mythtv 9 0 123m 41m 22m S 0.0 8.2 0:40.39 mythfrontend
545 root 9 0 123m 41m 22m S 0.0 8.2 0:00.05 mythfrontend
547 root 9 0 123m 41m 22m S 0.0 8.2 0:00.00 mythfrontend
550 root 9 0 123m 41m 22m S 0.0 8.2 0:00.79 mythfrontend
554 root 9 0 123m 41m 22m S 0.0 8.2 0:00.01 mythfrontend
21905 root 9 0 123m 41m 22m S 0.0 8.2 0:00.00 mythfrontend
21908 root 11 0 123m 41m 22m S 15.4 8.2 0:02.87 mythfrontend
21909 root 9 0 123m 41m 22m S 0.0 8.2 0:00.00 mythfrontend
21910 root 9 0 123m 41m 22m S 0.0 8.2 0:00.00 mythfrontend
21911 root 1 -19 123m 41m 22m S 1.6 8.2 0:00.34
More information about the mythtv-users