Re: Generalize /proc/fs/kernel/max-thread

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Mon, 21 Dec 1998 15:47:20 +0000


On Mon, Dec 21, 1998 at 01:33:40PM +0100, Jean-Michel VANSTEENE wrote:
> The value returned is the current max number of tasks, let say,
> NR_TASKS (or DEFAULT_MAX_THREADS in his patch).
> I think it is a good idea and could be generalized to standard
> kernel.
>
> So procps utilities could open this "file" to read the current
> NR_TASK and malloc the internal table with to the right size.

(a) The number of active tasks is the number of links to the /proc
directory, minus some small constant.

(b) NR_TASK is going to be much larger than the actual number of
tasks, so it would be silly to preallocate. Consider if NR_TASK were
100000.

(c) I'd expect approximately 0% performance improvement due to getting
the right size. But you can get it anyway (see (a)). Resizing tables
is cheap unless the tables are very large, and then it's usually time to
use something else.

(d) the procps utilities time is mostly spent reading files in /proc.

> This will improve procps tools and make them really "exportable".
> Agree?

Nope. To be honest, I can't see any reason to export NR_TASKS except
for administrative purposes (setting your preferred limit).

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/