Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 1996 12:33:32 +0100 (BST)
From:      Nik Clayton <nik@blueberry.co.uk>
To:        jfieber@indiana.edu (John Fieber)
Cc:        questions@freebsd.org, andreas@knobel.gun.de
Subject:   Re: fvwm95 port and process limits / bin/sh problem?
Message-ID:  <199604231133.MAA09074@plum.blueberry.co.uk>
In-Reply-To: <Pine.NEB.3.93.960422233652.2776B-100000@Fieber-John.campusview.indiana.edu> from "John Fieber" at Apr 22, 96 11:42:59 pm

next in thread | previous in thread | raw e-mail | index | archive | help
cc'd to questions for completeness, and to Andreas Klemm, who is the fvwm95
port maintainer.

> On Mon, 22 Apr 1996, Nik Clayton wrote:
> > to know if (a) anyone using fvwm95 with FreeBSD has noticed this (b) what's
> > a 'good' figure for maxusers (the handbook says '4' should be enough for
> > anyone, but that doesn't gel with my experience) and (c) are there any
> 
> 4?  Why of course!  Next you will start making absurd claims that
> people will need more than 640K of ram!   Sheesh!    ;-)
> 
> Seriously, I have:
> 
>   maxusers        15
>   options         "CHILD_MAX=128"
> 
> which seems to work just dandy, though I have not tried fvwm95.
> I used to use fvwm, but have been running mwm for a month or so
> now.

Hmm. I don't use the CHILD_MAX option (although I'll try it). Is it accessible
through sysctl? I couldn't see it in the output from -A. And what's the
default value.

I've been doing some more digging into this though.

First off, some config info:

    kern.maxproc = 340
    kern.maxprocperuid = 339

Now, I wrote a quick program to keep forking, keep a count of the number
of children it could create simultaneously before fork() returns an error
code, and then exit. And this shows 

    Where           Number of children           px -ax | wc -l
   -------------------------------------------------------------
    Console         38                           28
    fvwm95-2        26                           40
    ctwm            31                           36

Those figures seem about right, as I fire off five more processes in my 
.fvwm2rc95 than in my .ctwmrc.

Examining the ps output seems to give one more clue, which I think is the
nub of the problem.

fvwm appears to run programs by passing the command line to "/bin/sh -c"
(this can be seen in builtins.c::exec_function() in the fvwm source). And 
for any program that's run, this seems to add an extra process. As an aside, 
I don't see the '-c' option documented in sh(1).

For example, if my program (mentioned above) shows that it could fork()
26 times, then running an xterm using fvwm's menus (or buttons) reduces
this figure to 23. Doing the same operation with ctwm reduces the number
to 24. This reduction by two seems correct, since an xterm will spawn itself
and one shell. It looks like fvwm is spawning /bin/sh, the xterm, and the
xterm then runs the shell, for a total of three processes.

As a simple minded hack, I tried replacing the call to execl() in
builtins.c::exec_function() with one to system(), which (as far as I can
tell) is the call ctwm uses to spawn new programs. But this generated
lots of X event errors which I'm not qualified to debug.

So, is this an fvwm problem or a sh problem? Anyone more qualified than I
care to comment?

N
-- 
--+=[ Blueberry Hill                   Blueberry Design                   ]=+--
--+=[ http://www.blueberry.co.uk/      1/9 Chelsea Harbour Design Centre, ]=+--
--+=[ WebMaster@blueberry.co.uk        London, England, SW10 0XE          ]=+--
--+=[       Don't anthropomorphize computers.  They don't like it.        ]ENTP



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604231133.MAA09074>